Linux之Apache基本操作

Linux之Apache基本操作

    ps -ef | grep httpd 查看httpd进程是否存在

   sudo netstat -anpl | grep 'http'  网络统计 

 

配置自己的私有域名

cd /etc/httpd/conf 编辑httpd.conf文件 (sudo vim htttp.conf)

找到virtual host being defined. 和ServerAdmin: Your address, 两者之间 添加

<VirtualHost *:80>  //监听端口

        ServerName www.zktest.test  // 域名

        DocumentRoot /data/www  // 文件根目录创建的文件目录(/data/www/index.html 如若没有则自己创建)

        <Directory "/data/www">  // 访问目录

                Options Indexes FollowSymLinks

                AllowOverride None

                Require all granted  //访问权限

</Directory>

</VirtualHost>

 

回到自己的电脑 编辑 sudo  vim /etc/hosts文件 编写文件 192.168.x.x   www.zktest.test 

重启自己的服务器 就可访问自己的域名了!

如若不能访问

sudo setenforce 0 设置为0 

 sudo setenforce 0|| 1  设置成强制模式和宽松模式

Linux之Apache基本操作

sudo vim /etc/selinux/config

进入 编辑的文件把setenforce 设置成disabled 每次Apache重启可以继续访问

别忘记要关闭防火墙 service firewalld stop

 

Linux之Apache基本操作

conf.module.d 模块的配置文件

modules  模块的类