lamp配置域名[通俗易懂]

lamp配置域名[通俗易懂]windows访问的时候,记得把本机的windows/system32/drivers/etc/hosts文件中填上相应的配置(相当于dns)配置虚拟主机1)配置host文件/etc/hosts打开C:/windows/system32/drivers/etc/hosts文件增加域名记录如:192.168.9.38www.ec1.com192.168.9.38

windows 访问的时候,记得把本机的 windows/system32/drivers/etc/hosts文件中填上相应的配置(相当于dns )
配置虚拟主机

1)配置host文件 /etc/hosts

打开C:/windows/system32/drivers/etc/hosts 文件
增加域名记录
如:
192.168.9.38 www.ec1.com
192.168.9.38 www.ec2.com

2) 增加虚拟主机

vi /usr/local/http2/conf/httpd.conf
取消# Include conf/extra/httpd-vhosts.conf
这一行前面的#号
保存退出

vi /usr/local/http2/conf/extra/httpd-vhosts.conf
增加虚拟主机记录

<VirtualHost *:80>
        ServerAdmin webmaster@dummy-host.example.com
        DocumentRoot "/usr/local/http2/htdocs/ec1"
        ServerName www.ec1.com
        ServerAlias www.dummy-host.example.com
        ErrorLog "logs/dummy-host.example.com-error_log"
        CustomLog "logs/dummy-host.example.com-access_log" common
</VirtualHost>
只听到从架构师办公室传来架构君的声音:
语罢更携手,月明洲渚生。有谁来对上联或下联?
此代码由Java架构师必看网-架构君整理
<VirtualHost *:80> ServerAdmin webmaster@dummy-host2.example.com DocumentRoot "/usr/local/http2/htdocs/ec2" ServerName www.ec2.com ErrorLog "logs/dummy-host2.example.com-error_log" CustomLog "logs/dummy-host2.example.com-access_log" common </VirtualHost>
<VirtualHost *:80>
        DocumentRoot "/var/www/shop"
        ServerName www.ec1.com
</VirtualHost>

注意:/var/www/shop 以上三个目录var www shop 的其他用户必须有x可执行权限

架构君码字不易,如需转载,请注明出处:https://javajgs.com/archives/209266
0

发表评论