123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263 |
- #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;
- upstream appservice {
- server localhost:8080;
- }
-
- upstream oauth2 {
- server localhost:8081;
- }
- upstream websocketws {
- server localhost:3016;
- }
- upstream imservice {
- server localhost:3017;
- }
- server {
- listen 3006 backlog=1024;
- index index.html;
- server_name localhost;
- root /data/src/remote/h5;
- gzip on;
- gzip_disable "msie6";
- # access_log /var/log/nginx/ws.access.log main;
- # error_log /var/log/nginx/ws.error.log;
- location / {
- proxy_pass http://websocketws;
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "Upgrade";
- proxy_connect_timeout 5;
- proxy_read_timeout 60;
- proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504 http_404;
- }
- }
- server {
- listen 80;
- server_name localhost;
- #charset koi8-r;
- #access_log logs/host.access.log main;
- location / {
- add_header 'Access-Control-Allow-Origin' '*';
- add_header 'Access-Control-Allow-Credentials' 'true';
- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
- add_header 'Access-Control-Allow-Headers' 'sn, Content-Type';
- add_header 'Access-Control-Expose-Headers' 'sn, Origin, X-Requested-With, Content-Type, Accept, Authorization';
- add_header 'Access-Control-Allow-Headers' 'X-Custom-Header, Origin, X-Requested-With, Content-Type, Accept, Authorization';
- proxy_redirect off;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header Referer $http_referer;
- proxy_pass http://appservice;
- proxy_http_version 1.1;
- proxy_set_header Connection "";
- client_max_body_size 1000m;
- proxy_connect_timeout 5;
- proxy_read_timeout 60;
- proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504 http_404;
- }
- location ~ ^/(acc|oauth)/ {
- add_header 'Access-Control-Allow-Origin' '$http_origin';
- add_header 'Access-Control-Allow-Credentials' 'true';
- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
- add_header 'Access-Control-Allow-Headers' 'sn, Content-Type';
- add_header 'Access-Control-Expose-Headers' 'sn, Origin, X-Requested-With, Content-Type, Accept, Authorization';
- add_header 'Access-Control-Allow-Headers' 'X-Custom-Header, Origin, X-Requested-With, Content-Type, Accept, Authorization';
- proxy_redirect off;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header Referer $http_referer;
- proxy_pass http://oauth2;
- proxy_http_version 1.1;
- proxy_set_header Connection "";
- client_max_body_size 1000m;
- proxy_connect_timeout 10;
- proxy_read_timeout 10;
- proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504 http_404;
- }
- location ~ ^/(imroom|imtest|iminnerapi|test)/ {
- #add_header 'Access-Control-Allow-Origin' '*';
- #add_header 'Access-Control-Allow-Credentials' 'true';
- #add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
- #add_header 'Access-Control-Allow-Headers' 'sn, Content-Type';
- #add_header 'Access-Control-Expose-Headers' 'sn, Origin, X-Requested-With, Content-Type, Accept, Authorization';
- #add_header 'Access-Control-Allow-Headers' 'X-Custom-Header, Origin, X-Requested-With, Content-Type, Accept, Authorization';
- proxy_redirect off;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header Referer $http_referer;
- proxy_pass http://imservice;
- proxy_http_version 1.1;
- proxy_set_header Connection "";
- client_max_body_size 1000m;
- proxy_connect_timeout 5;
- proxy_read_timeout 60;
- proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504 http_404;
- }
- }
- # 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;
- # }
- #}
- }
|