0
点赞
收藏
分享

微信扫一扫

nginx系列---【niginx的常用配置】

书呆鱼 2022-06-01 阅读 62

话不多说,上代码。

下面为nginx的conf目录下的nginx.conf文件

#user  nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;


events {
worker_connections 1024;
}


http {
include mime.types;
default_type application/octet-stream;

#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;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;

#gzip on;


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;

# location / {
# root html;
# index index.html index.htm;
# }
#}


# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;

# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;

# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;

# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;

# location / {
# root html;
# index index.html index.htm;
# }
#}
#
#
upstream webapi {
server 120.8.166.197:8097 ;
}
upstream webapinocam {
server 120.8.166.197:8089 ;
}

upstream webapitest {
server 120.8.166.197:8088 ;
}
upstream webapilocalhost {
server 172.18.11.127:8088 ;
}

upstream dbreport {
server 120.8.166.197:8085;
}

server {
listen 8081;
server_name localhost;



location / {
root /apps/usr/sms2019/SMS-OMS/html;
index index.html index.htm;

}

location ^~ /api {
proxy_pass http://webapitest;

}
location ^~ /web {
proxy_pass http://dbreport;

}

}
server{
listen 8082;
server_name dblocalhost;
location / {
root /apps/usr/html;
index index.html index.htm;
}
location ^~ /api {
proxy_pass http://webapilocalhost;

}


}

server {
listen 8096;
server_name localhost;



location / {
root /apps/usr/sms2019/CAM-TEST/SMS-OMS/html;
index index.html index.htm;


}

location ^~ /api {
proxy_pass http://webapi;

}
}

server {
listen 8092;
server_name localhost;



location / {
root /apps/usr/sms2019/test/SMS-OMS/html;
index index.html index.htm;

}

location ^~ /api {
proxy_pass http://webapinocam;

}
location ^~ /web {
proxy_pass http://dbreport;

}

}
}

 

举报

相关推荐

0 条评论