Advertisement
Guest User

Untitled

a guest
Jul 5th, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 3.36 KB | None | 0 0
  1. upstream node {
  2.     ip_hash;
  3.     server paqt.chat:4000;
  4. }
  5.  
  6. server {
  7.     listen 443 ssl;
  8.     server_name paqt.chat;
  9.  
  10.     root /var/www/html/frontend_build;
  11.  
  12.     access_log /var/log/nginx/frontend-access.log;
  13.     error_log /var/log/nginx/frontend-error.log;
  14.     index index.html;
  15.  
  16.     ssl_certificate /etc/letsencrypt/live/paqt.chat/fullchain.pem;
  17.     ssl_certificate_key /etc/letsencrypt/live/paqt.chat/privkey.pem;
  18.    
  19.     include /etc/letsencrypt/options-ssl-nginx.conf;
  20.     ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
  21.  
  22.     location / {
  23.         try_files $uri /index.html =404;
  24.     }
  25.  
  26.     location /static {
  27.         try_files $uri =404;
  28.     }
  29.  
  30.     location /node {
  31.         proxy_pass http://node;
  32.         proxy_http_version 1.1;
  33.         proxy_set_header Upgrade $http_upgrade;
  34.         proxy_set_header Connection 'upgrade';
  35.         proxy_set_header Host $host;
  36.         proxy_cache_bypass $http_upgrade;
  37.     }
  38. }
  39.  
  40. server {
  41.     listen 8081 ssl;
  42.     server_name paqt.chat;
  43.  
  44.     root /var/www/html/public;
  45.     index index.php  index.html index.htm;
  46.  
  47.     access_log /var/log/nginx/access.log;
  48.     error_log /var/log/nginx/error.log;
  49.  
  50.     ssl_certificate /etc/letsencrypt/live/paqt.chat/fullchain.pem;
  51.     ssl_certificate_key /etc/letsencrypt/live/paqt.chat/privkey.pem;
  52.    
  53.     include /etc/letsencrypt/options-ssl-nginx.conf;
  54.     ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
  55.  
  56.     location / {
  57.         try_files $uri $uri/ /index.php?$args;
  58.     }
  59.  
  60.     location ~ \.php$ {
  61.         if ($request_method = 'OPTIONS') {
  62.             add_header 'Access-Control-Allow-Origin' '*' always;
  63.             add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
  64.             add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range,Authorization';
  65.             add_header 'Access-Control-Max-Age' 1728000;
  66.             add_header 'Content-Type' 'text/plain; charset=utf-8';
  67.             add_header 'Content-Length' 0;
  68.             return 204;
  69.         }
  70.         if ($request_method ~ 'POST|GET|PUT|DELETE') {
  71.             add_header 'Access-Control-Allow-Origin' '*' always;
  72.             add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
  73.             add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
  74.             add_header 'Access-Control-Expose-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range,Authorization';
  75.         }
  76.  
  77.         try_files $uri =404;
  78.         fastcgi_split_path_info ^(.+\.php)(/.+)$;
  79.         fastcgi_pass phpfpm:9000;
  80.         fastcgi_index index.php;
  81.         include fastcgi_params;
  82.         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  83.         fastcgi_param PATH_INFO $fastcgi_path_info;
  84.     }
  85. }
  86.  
  87. server {
  88.     listen 80;
  89.     server_name paqt.chat;
  90.  
  91.     root /var/www/html/frontend_build;
  92.  
  93.     access_log /var/log/nginx/frontend-access.log;
  94.     error_log /var/log/nginx/frontend-error.log;
  95.     index index.html;
  96.  
  97.     location /.well-known/acme-challenge/ {
  98.         root /var/www/certbot;
  99.     }
  100.  
  101.     location / {
  102.         return 301
  103.         https://$host$request_uri;    
  104.     }    
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement