Nginx配置多端口多域名访问

查看 ps aux | grep nginx 查看ng状态

pkill nginx 停止ng

 

第一、在xx/nginx/conf/ 下建立vhost_conf 文件夹

第二、写入配置Vhost文件

server {

listen 80;

server_name jin.jenkins.com;

 

#charset koi8-r;

 

access_log logs/jin.jenkins.com.log main;

#给域名地址追加 jenkins 目录

if ( $request_filename !~ "jenkins" ) {

rewrite (.*) /jenkins/$1 break;

}

location / {

proxy_pass http://192.168.20.214:8088;

}

}

 

第三、修改xx/nginx/conf/nginx.conf 文件

 

可选 #pid logs/nginx.pid; pid文件目录设置

可选 log文件的输出

#log_format main '$remote_addr - $remote_user [$time_local] "$request" '

'$status $body_bytes_sent "$http_referer" '

'"$http_user_agent" "$http_x_forwarded_for"';

 

#access_log logs/access.log main;

 

必填、include vhost_conf目录下的配置文件

你可能感兴趣的:(Nginx配置多端口多域名访问)