首页 > 其他 > 详细

基于端口的配置方式

时间:2019-05-03 11:58:05      阅读:132      评论:0      收藏:0      [点我收藏+]

1.配置多端口的虚拟主机

[root@web01 conf.d]# vim port.conf

server {

listen 81;

location / {

root /code_81;

index index.html;

}

}

server {

listen 82;

location / {

root /code_82;

index index.html;

}

}????????

?

2.根据配置文件创建所需的目录

[root@web01 conf.d]# mkdir /code_8{1..2}

[root@web01 conf.d]# echo "81" > /code_81/index.html

[root@web01 conf.d]# echo "82" > /code_82/index.html

?

3.检查语法并重启服务

[root@web01 conf.d]# nginx -t

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok

nginx: configuration file /etc/nginx/nginx.conf test is successful

[root@web01 conf.d]# systemctl restart nginx

?

4.如何去访问

????http://10.0.0.7:82/

基于端口的配置方式

原文:https://www.cnblogs.com/yexiuer/p/10804575.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!