apache

本文涉及的产品
云原生数据库 PolarDB MySQL 版,Serverless 5000PCU 100GB
云数据库 RDS SQL Server,独享型 2核4GB
云原生数据库 PolarDB 分布式版,标准版 2核8GB
简介: apache

yum -y install apr* pcre* openssl* gcc*

./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-charset-lite --enable-cgi

make && make install

ln -s /usr/local/httpd/bin/* /usr/local/bin

cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd

两种启动httpd服务方法

1.vim /etc/init.d/httpd

在/bin/bash下面加两条

#chkconfig: 35 85 21

#description: Startup script for the Apache HTTP Server

chkconfig --add httpd

结束

2.

vim /lib/systemd/system/httpd.service

添加以下内容:

[Unit]

Description-The Apache HTTP Server

After =network.target

[Service]

Type =forking

PIDFile =/usr/local/httpd/logs/httpd.pid

ExecStart =/usr/local/bin/apachectlSOPTIONS

ExecReload =/bin/kill- HUPSMAINPID

KillMode =process

Restart =on-failure

Restartsec =42s

[Install]

WantedBy =graphical.target

结束

mkdir -p /var/www/html/lylcom

echo "

who am i

" > /var/www/html/lylcom/index.html

mkdir -p /var/www/html/lyl2com

echo "

what is my name

" > /var/www/html/lyl2com/index.html

vim /usr/local/httpd/conf/httpd.conf

多端口必须在此配置文件中另写一条Listen 端口号

添加

Include conf/extra/httpd-vhosts.conf

vim /etc/hosts

192.168.1.1 www.lyl.com

三种方式(别忘了systemctl start httpd 如果启动后修改了就restart)

vim /usr/local/httpd/conf/extra/httpd-vhosts.conf

DocumentRoot "/var/www/html/lyl

ServerName www.lyl.com

Require all granted

   DocumentRoot "/var/www/html/lyl2com

   ServerName www.lyl2.com

2.基于端口

   DocumentRoot "/var/www/html/lylcom

   ServerName www.lyl.com

Require all granted

   DocumentRoot "/var/www/html/lyl2com

   ServerName www.lyl2.com

3.基于域名

   DocumentRoot "/var/www/html/lylcom

   ServerName www.lyl.com

Require all granted

   DocumentRoot "/var/www/html/lyl2com

   ServerName www.lyl2.com

相关文章
|
12月前
|
应用服务中间件 Shell PHP
Apache
Apache(音译为阿帕奇)是世界使用排名第一的Web服务器软件。它可以运行在几乎所有广泛使用的计算机平台上,由于其跨平台和安全性被广泛使用,是最流行的Web服务器端软件之一。它快速、可靠并且可通过简单的API扩充,将Perl/Python等解释器编译到服务器中。
204 0
|
Apache
Apache Plusar社区资源总结
Apache Plusar社区资源总结
98 0
|
前端开发 Shell Apache
|
Apache 数据安全/隐私保护 网络协议
|
消息中间件 Apache
|
Apache 数据安全/隐私保护 Python
|
Web App开发 PHP Apache