赞
踩
CentOS 7.5已经安装好nginx和gitlab服务,其中nginx默认端口80, gitlab端口配置成83, 并且端口83已经加入阿里云安全组里面!
[root@iZ8vb2zp3hb2pskrfnjcrbZ nginx]# mkdir /etc/nginx/vhost
[root@iZ8vb2zp3hb2pskrfnjcrbZ nginx]# cd /etc/nginx/vhost
# www.testa.com [root@iZ8vb2zp3hb2pskrfnjcrbZ nginx]# vi vhost_testa.conf server { listen 80; server_name www.testa.com testa.com; root /home/website/testa; location / { index index.html index.htm index.php; } } # www.testb.com [root@iZ8vb2zp3hb2pskrfnjcrbZ nginx]# vi vhost_testb.conf server { listen 80; server_name www.testb.com testb.com; root /home/website/testb; location / { index index.html index.htm index.php; } } # gitlab.code.com [root@iZ8vb2zp3hb2pskrfnjcrbZ nginx]# vi vhost_gitlab.conf server { listen 80; server_name gitlab.code.com; root /usr/share/nginx/html; index index.html index.htm index.php; #default index location / { proxy_pass http://localhost:83; #此处在作重定向,也作很多处理 } }
根据conf配置文件:
[root@iZ8vb2zp3hb2pskrfnjcrbZ vhost]# vi /etc/nginx/nginx.conf
...
http {
...
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
# include /etc/nginx/conf.d/*.conf;
# 加上路径
include /etc/nginx/vhost/*.conf;
...
}
[root@iZ8vb2zp3hb2pskrfnjcrbZ vhost]# nginx -s reload
[root@iZ8vb2zp3hb2pskrfnjcrbZ vhost]# service nginx restart
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。