Nginx nginx-1.14.0配置文件 实现 监听80端口 xxx.xxx1.com域名(可以是http 也可以是https)转发到http://127.0.0.1:20141/;
完整的nginx.conf
user root;
#user nobody;
worker_processes 1;
#error_log /data/wwwlogs/error_nginx.log crit;
error_log /usr/local/nginx/mylog/error_nginx.log crit;#设置错误日志路径
pid /var/run/nginx.pid;
worker_rlimit_nofile 51200;
events {
worker_connections 51200;
}
http {
include mime.types;
default_type application/octet-stream;
resolver 8.8.8.8;
sendfile on;
keepalive_timeout 65;
# 监听80端口 xxx.xxx1.com域名(可以是http 也可以是https)转发到http://127.0.0.1:20141/;
server {
listen 80;
server_name xxx.xxx1.com;
location / {
proxy_pass http://127.0.0.1:20141/;
}
}
#监听80端口 xxx.xxx1.com域名(可以是http 也可以是https)转发到http://127.0.0.1:20151/;
server {
listen 80;
server_name xxx.xxx2.com;
location / {
proxy_pass http://127.0.0.1:20151/;
}
}
#监听80端口 xxx.xxx3.com域名(可以是http 也可以是https)转发到http://127.0.0.1:20102/;
server {
listen 80;
server_name xxx.xxx3.com;
location / {
proxy_pass http://127.0.0.1:20102/;
}
}
}
需要下载nginx:
wget http://nginx.org/download/nginx-1.14.0.tar.gz
|