Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
642 views
in Technique[技术] by (71.8m points)

怎么让phpStudy下多个二级域名指向443端口或者80端口,在线上环境

1.png
但是这里打开第四个就不显示,该网站无法访问


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

step1 添加域名指向
www.test.com 127.0.0.1
app.test.com 127.0.0.1

step1 在nginx或apache中配置虚拟域名

nginx

server {
    server_name www.test.com 
}
server {
    app.test.com 
}

apache

<VirtualHost 192.168.10.10>
    DocumentRoot "/home/wwwroot/www"
    ServerName "www.test.com"
    <Directory "/home/wwwroot/www">
        AllowOverride None
        Require all granted
    </directory> 
</VirtualHost>

<VirtualHost 192.168.10.10>
    DocumentRoot "/home/wwwroot/bbs"
    ServerName "app.test.com"
    <Directory "/home/wwwroot/bbs">
        AllowOverride None
        Require all granted
    </Directory>
</VirtualHost>

如果是phpstudy,直接在涂黑的地方设置域名即可


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...