apache

本文涉及的产品
云数据库 RDS SQL Server,基础系列 2核4GB
RDS SQL Server Serverless,2-4RCU 50GB 3个月
推荐场景:
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
简介: 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

相关文章
|
1月前
|
Java Apache PHP
Apache
Apache
49 5
|
Apache
Apache Plusar社区资源总结
Apache Plusar社区资源总结
113 0
|
前端开发 Shell Apache
|
Java Apache
|
Apache 数据安全/隐私保护 网络协议
|
消息中间件 Apache
|
Apache 数据安全/隐私保护 Python
下一篇
DataWorks