Apache

基本操作

// 安装
yum install httpd
// 启动
service httpd start
// 停止
service httpd stop

查询进程是否存在

ps -ef | gref httpd

查询端口是否监听

sudo netstat -anpl | grep 'http'

配置虚拟主机

cd /etc/httpd/conf
vim httpd.conf
<VirtualHost *:80>
    ServerName www.hello.test
    DocumentRoot /data/www
    <Directory "/data/www">
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
    </Directory>
</VirtualHost>

重启服务器

service httpd restart

建立根目录

sudo mkdir -p /data/www

新建index.html并提权

sudo chown -R user1:user1 /data
vim index.html

设置为宽松模式

// 在配置中设置
sudo vim /etc/selinux/config
sudo setenforce 0
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容