Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.29 KB | None | 0 0
  1. ##
  2. # You should look at the following URL's in order to grasp a solid understanding
  3. # of Nginx configuration files in order to fully unleash the power of Nginx.
  4. # https://www.nginx.com/resources/wiki/start/
  5. # https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
  6. # https://wiki.debian.org/Nginx/DirectoryStructure
  7. #
  8. # In most cases, administrators will remove this file from sites-enabled/ and
  9. # leave it as reference inside of sites-available where it will continue to be
  10. # updated by the nginx packaging team.
  11. #
  12. # This file will automatically load configuration files provided by other
  13. # applications, such as Drupal or Wordpress. These applications will be made
  14. # available underneath a path with that package name, such as /drupal8.
  15. #
  16. # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
  17. ##
  18.  
  19. # Default server configuration
  20. #
  21. server {
  22.  
  23. # SSL configuration
  24. #
  25. # listen 443 ssl default_server;
  26. # listen [::]:443 ssl default_server;
  27. #
  28. # Note: You should disable gzip for SSL traffic.
  29. # See: https://bugs.debian.org/773332
  30. #
  31. # Read up on ssl_ciphers to ensure a secure configuration.
  32. # See: https://bugs.debian.org/765782
  33. #
  34. # Self signed certs generated by the ssl-cert package
  35. # Don't use them in a production server!
  36. #
  37. # include snippets/snakeoil.conf;
  38.  
  39. root /var/www/html;
  40.  
  41. # Add index.php to the list if you are using PHP
  42. index index.html index.htm index.nginx-debian.html;
  43.  
  44. server_name atlantis.best www.atlantis.best_;
  45.  
  46. location / {
  47. # First attempt to serve request as file, then
  48. # as directory, then fall back to displaying a 404.
  49. proxy_pass http://localhost:3000; #whatever port your app runs on
  50. proxy_http_version 1.1;
  51. proxy_set_header Upgrade $http_upgrade;
  52. proxy_set_header Connection 'upgrade';
  53. proxy_set_header Host $host;
  54. proxy_cache_bypass $http_upgrade;
  55. }
  56.  
  57. # pass PHP scripts to FastCGI server
  58. #
  59. #location ~ \.php$ {
  60. # include snippets/fastcgi-php.conf;
  61. #
  62. # # With php-fpm (or other unix sockets):
  63. # fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
  64. # # With php-cgi (or other tcp sockets):
  65. # fastcgi_pass 127.0.0.1:9000;
  66. #}
  67.  
  68. # deny access to .htaccess files, if Apache's document root
  69. # concurs with nginx's one
  70. #
  71. #location ~ /\.ht {
  72. # deny all;
  73. #}
  74.  
  75. listen [::]:443 ssl ipv6only=on; # managed by Certbot
  76. listen 443 ssl; # managed by Certbot
  77. ssl_certificate /etc/letsencrypt/live/atlantis.best/fullchain.pem; # managed by Certbot
  78. ssl_certificate_key /etc/letsencrypt/live/atlantis.best/privkey.pem; # managed by Certbot
  79. include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
  80. ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
  81.  
  82. }
  83.  
  84. server {
  85. listen [::]:443 ssl ipv6only=on; # managed by Certbot
  86. listen 443 ssl; # managed by Certbot
  87. ssl_certificate /etc/letsencrypt/live/atlantis.best/fullchain.pem; # managed by Certbot
  88. ssl_certificate_key /etc/letsencrypt/live/atlantis.best/privkey.pem; # managed by Certbot
  89. include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
  90. ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
  91.  
  92. server_name api.atlantis.best;
  93.  
  94. location / {
  95. proxy_pass http://localhost:4000;
  96. proxy_set_header Host $http_host;
  97. proxy_set_header X-Real-IP $remote_addr;
  98. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  99. proxy_set_header X-Forwarded-Proto $scheme;
  100. proxy_set_header Upgrade $http_upgrade;
  101. proxy_set_header Connection "Upgrade";
  102. proxy_cache_bypass $http_upgrade;
  103. proxy_connect_timeout 7d;
  104. proxy_send_timeout 7d;
  105. proxy_read_timeout 7d;
  106. }
  107. }
  108.  
  109. server {
  110. listen [::]:443 ssl ipv6only=on; # managed by Certbot
  111. listen 443 ssl; # managed by Certbot
  112. ssl_certificate /etc/letsencrypt/live/atlantis.best/fullchain.pem; # managed by Certbot
  113. ssl_certificate_key /etc/letsencrypt/live/atlantis.best/privkey.pem; # managed by Certbot
  114. include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
  115. ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
  116.  
  117. server_name aperture.atlantis.best;
  118.  
  119. location / {
  120. proxy_pass http://localhost:9001;
  121. proxy_set_header Host $http_host;
  122. proxy_set_header X-Real-IP $remote_addr;
  123. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  124. proxy_set_header X-Forwarded-Proto $scheme;
  125. proxy_set_header Upgrade $http_upgrade;
  126. proxy_set_header Connection "Upgrade";
  127. proxy_cache_bypass $http_upgrade;
  128. proxy_connect_timeout 7d;
  129. proxy_send_timeout 7d;
  130. proxy_read_timeout 7d;
  131. }
  132. }
  133.  
  134.  
  135. # Virtual Host configuration for example.com
  136. #
  137. # You can move that to a different file under sites-available/ and symlink that
  138. # to sites-enabled/ to enable it.
  139. #
  140. #server {
  141. # listen 80;
  142. # listen [::]:80;
  143. #
  144. # server_name example.com;
  145. #
  146. # root /var/www/example.com;
  147. # index index.html;
  148. #
  149. # location / {
  150. # try_files $uri $uri/ =404;
  151. # }
  152. #}
  153.  
  154. server {
  155.  
  156. # SSL configuration
  157. #
  158. # listen 443 ssl default_server;
  159. # listen [::]:443 ssl default_server;
  160. #
  161. # Note: You should disable gzip for SSL traffic.
  162. # See: https://bugs.debian.org/773332
  163. #
  164. # Read up on ssl_ciphers to ensure a secure configuration.
  165. # See: https://bugs.debian.org/765782
  166. #
  167. # Self signed certs generated by the ssl-cert package
  168. # Don't use them in a production server!
  169. #
  170. # include snippets/snakeoil.conf;
  171.  
  172. root /var/www/html;
  173.  
  174. # Add index.php to the list if you are using PHP
  175. index index.html index.htm index.nginx-debian.html;
  176. server_name www.atlantis.best; # managed by Certbot
  177.  
  178.  
  179. location / {
  180. # First attempt to serve request as file, then
  181. # as directory, then fall back to displaying a 404.
  182. proxy_pass http://localhost:3000; #whatever port your app runs on
  183. proxy_http_version 1.1;
  184. proxy_set_header Upgrade $http_upgrade;
  185. proxy_set_header Connection 'upgrade';
  186. proxy_set_header Host $host;
  187. proxy_cache_bypass $http_upgrade;
  188. }
  189.  
  190. # pass PHP scripts to FastCGI server
  191. #
  192. #location ~ \.php$ {
  193. # include snippets/fastcgi-php.conf;
  194. #
  195. # # With php-fpm (or other unix sockets):
  196. # fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
  197. # # With php-cgi (or other tcp sockets):
  198. # fastcgi_pass 127.0.0.1:9000;
  199. #}
  200.  
  201. # deny access to .htaccess files, if Apache's document root
  202. # concurs with nginx's one
  203. #
  204. #location ~ /\.ht {
  205. # deny all;
  206. #}
  207.  
  208. listen [::]:443 ssl ; # managed by Certbot
  209. listen 443 ssl; # managed by Certbot
  210. ssl_certificate /etc/letsencrypt/live/atlantis.best/fullchain.pem; # managed by Certbot
  211. ssl_certificate_key /etc/letsencrypt/live/atlantis.best/privkey.pem; # managed by Certbot
  212. include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
  213. ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
  214.  
  215.  
  216.  
  217. }
  218. server {
  219. if ($host = atlantis.best) {
  220. return 301 https://$host$request_uri;
  221. } # managed by Certbot
  222.  
  223.  
  224. listen 80 default_server;
  225. listen [::]:80 default_server;
  226.  
  227. server_name atlantis.best www.atlantis.best_;
  228. return 404; # managed by Certbot
  229.  
  230.  
  231. }
  232. server {
  233. if ($host = www.atlantis.best) {
  234. return 301 https://$host$request_uri;
  235. } # managed by Certbot
  236.  
  237.  
  238. listen 80 ;
  239. listen [::]:80 ;
  240. server_name www.atlantis.best;
  241. return 404; # managed by Certbot
  242.  
  243.  
  244. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement