Advertisement
Guest User

Nginx config

a guest
Dec 26th, 2024
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 9.33 KB | Fixit | 0 0
  1. # configuration file /etc/nginx/nginx.conf:
  2. user www-data;
  3. worker_processes auto;
  4. pid /run/nginx.pid;
  5. error_log /var/log/nginx/error.log;
  6. include /etc/nginx/modules-enabled/*.conf;
  7.  
  8. events {
  9.         worker_connections 768;
  10.         # multi_accept on;
  11. }
  12.  
  13. http {
  14.  
  15.         ##
  16.         # Basic Settings
  17.         ##
  18.  
  19.         sendfile on;
  20.         tcp_nopush on;
  21.         types_hash_max_size 2048;
  22.         # server_tokens off;
  23.  
  24.         # server_names_hash_bucket_size 64;
  25.         # server_name_in_redirect off;
  26.  
  27.         include /etc/nginx/mime.types;
  28.         default_type application/octet-stream;
  29.  
  30.         ##
  31.         # SSL Settings
  32.         ##
  33.  
  34.         ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POOD                                                                                                             LE
  35.         ssl_prefer_server_ciphers on;
  36.  
  37.         ##
  38.         # Logging Settings
  39.         ##
  40.  
  41.         access_log /var/log/nginx/access.log;
  42.  
  43.         ##
  44.         # Gzip Settings
  45.         ##
  46.  
  47.         gzip on;
  48.  
  49.         # gzip_vary on;
  50.         # gzip_proxied any;
  51.         # gzip_comp_level 6;
  52.         # gzip_buffers 16 8k;
  53.         # gzip_http_version 1.1;
  54.         # gzip_types text/plain text/css application/json application/javascript                                                                                                              text/xml application/xml application/xml+rss text/javascript;
  55.  
  56.         ##
  57.         # Virtual Host Configs
  58.         ##
  59.         include /etc/nginx/conf.d/*.conf;
  60.         # include /etc/nginx/sites-enabled/*;
  61. }
  62.  
  63.  
  64. #mail {
  65. #       # See sample authentication script at:
  66. #       # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
  67. #
  68. #       # auth_http localhost/auth.php;
  69. #       # pop3_capabilities "TOP" "USER";
  70. #       # imap_capabilities "IMAP4rev1" "UIDPLUS";
  71. #
  72. #       server {
  73. #               listen     localhost:110;
  74. #               protocol   pop3;
  75. #               proxy      on;
  76. #       }
  77. #
  78. #       server {
  79. #               listen     localhost:143;
  80. #               protocol   imap;
  81. #               proxy      on;
  82. #       }
  83. #}
  84.  
  85. # configuration file /etc/nginx/mime.types:
  86.  
  87. types {
  88.     text/html                             html htm shtml;
  89.     text/css                              css;
  90.     text/xml                              xml;
  91.     image/gif                             gif;
  92.     image/jpeg                            jpeg jpg;
  93.     application/javascript                js;
  94.     application/atom+xml                  atom;
  95.     application/rss+xml                   rss;
  96.  
  97.     text/mathml                           mml;
  98.     text/plain                            txt;
  99.     text/vnd.sun.j2me.app-descriptor      jad;
  100.     text/vnd.wap.wml                      wml;
  101.     text/x-component                      htc;
  102.  
  103.     image/avif                            avif;
  104.     image/png                             png;
  105.     image/svg+xml                         svg svgz;
  106.     image/tiff                            tif tiff;
  107.     image/vnd.wap.wbmp                    wbmp;
  108.     image/webp                            webp;
  109.     image/x-icon                          ico;
  110.     image/x-jng                           jng;
  111.     image/x-ms-bmp                        bmp;
  112.  
  113.     font/woff                             woff;
  114.     font/woff2                            woff2;
  115.  
  116.     application/java-archive              jar war ear;
  117.     application/json                      json;
  118.     application/mac-binhex40              hqx;
  119.     application/msword                    doc;
  120.     application/pdf                       pdf;
  121.     application/postscript                ps eps ai;
  122.     application/rtf                       rtf;
  123.     application/vnd.apple.mpegurl         m3u8;
  124.     application/vnd.google-earth.kml+xml  kml;
  125.     application/vnd.google-earth.kmz      kmz;
  126.     application/vnd.ms-excel              xls;
  127.     application/vnd.ms-fontobject         eot;
  128.     application/vnd.ms-powerpoint         ppt;
  129.     application/vnd.oasis.opendocument.graphics        odg;
  130.     application/vnd.oasis.opendocument.presentation    odp;
  131.     application/vnd.oasis.opendocument.spreadsheet     ods;
  132.     application/vnd.oasis.opendocument.text            odt;
  133.     application/vnd.openxmlformats-officedocument.presentationml.presentation                                                                                                                 pptx;
  134.     application/vnd.openxmlformats-officedocument.spreadsheetml.sheet    xlsx;
  135.     application/vnd.openxmlformats-officedocument.wordprocessingml.document    d                                                                                                             ocx;
  136.     application/vnd.wap.wmlc              wmlc;
  137.     application/wasm                      wasm;
  138.     application/x-7z-compressed           7z;
  139.     application/x-cocoa                   cco;
  140.     application/x-java-archive-diff       jardiff;
  141.     application/x-java-jnlp-file          jnlp;
  142.     application/x-makeself                run;
  143.     application/x-perl                    pl pm;
  144.     application/x-pilot                   prc pdb;
  145.     application/x-rar-compressed          rar;
  146.     application/x-redhat-package-manager  rpm;
  147.     application/x-sea                     sea;
  148.     application/x-shockwave-flash         swf;
  149.     application/x-stuffit                 sit;
  150.     application/x-tcl                     tcl tk;
  151.     application/x-x509-ca-cert            der pem crt;
  152.     application/x-xpinstall               xpi;
  153.     application/xhtml+xml                 xhtml;
  154.     application/xspf+xml                  xspf;
  155.     application/zip                       zip;
  156.  
  157.     application/octet-stream              bin exe dll;
  158.     application/octet-stream              deb;
  159.     application/octet-stream              dmg;
  160.     application/octet-stream              iso img;
  161.     application/octet-stream              msi msp msm;
  162.  
  163.     audio/midi                            mid midi kar;
  164.     audio/mpeg                            mp3;
  165.     audio/ogg                             ogg;
  166.     audio/x-m4a                           m4a;
  167.     audio/x-realaudio                     ra;
  168.  
  169.     video/3gpp                            3gpp 3gp;
  170.     video/mp2t                            ts;
  171.     video/mp4                             mp4;
  172.     video/mpeg                            mpeg mpg;
  173.     video/quicktime                       mov;
  174.     video/webm                            webm;
  175.     video/x-flv                           flv;
  176.     video/x-m4v                           m4v;
  177.     video/x-mng                           mng;
  178.     video/x-ms-asf                        asx asf;
  179.     video/x-ms-wmv                        wmv;
  180.     video/x-msvideo                       avi;
  181. }
  182.  
  183. # configuration file /etc/nginx/conf.d/shabbyserver_com-ssl.conf:
  184. server {
  185.     # SSL Certificates
  186.     ssl_certificate /home/peter/web/home_shabbyserver_com_chain.crt;
  187.     ssl_certificate_key /home/peter/web/home.shabbyserver.com.key;
  188.     listen 4433 ssl;
  189.     server_name home.shabbyserver.com;
  190.  
  191.     # Path to BlueMap webroot, served at /map
  192.     # root /var/www/html/;
  193.  
  194.     location /map/ {
  195.         alias /var/opt/minecraft/shabby/server/bluemap/web/;  # Map /map/ to the                                                                                                              assets directory
  196.         index index.html;                                    # Default file to s                                                                                                             erve
  197.         gzip_static always;                                 # Serve pre-compress                                                                                                             ed .gz files if available
  198.         # convert 404 into 204 for map-tiles
  199.         location ~* ^/maps/[^/]*/tiles/ {
  200.             error_page 404 = @empty;
  201.         }
  202.     }
  203.     location /router/ {
  204.         rewrite ^/router/?(.*)$ /$1 break;
  205.         proxy_pass  http://192.168.0.1;
  206.         proxy_set_header Host $host;
  207.         proxy_set_header X-Real-IP $remote_addr;
  208.         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  209.     }
  210.     location /cctv {
  211.         # rewrite ^/cctv/(.*)$ /$1 break;  # Strip /cctv from the path
  212.         proxy_pass http://localhost:9212/;
  213.     }
  214.     #location @empty {
  215.     #    return 204;                                         # Custom handler fo                                                                                                             r empty responses
  216.     #}
  217.  
  218.     # OPTIONAL:
  219.     # Proxy requests for live data to the BlueMap's integrated web server
  220.     # Uncomment and adapt for live data handling
  221.     # location ~* ^/maps/[^/]*/live/ {
  222.     #     proxy_pass http://127.0.0.1:8100;                  # Forward to BlueMa                                                                                                             p server
  223.     # }
  224. }
  225.  
  226. server {
  227.     listen 85;
  228.     server_name home.shabbyserver.com;
  229.  
  230.     # Redirect all HTTP requests to HTTPS
  231.     return 301 https://$host$request_uri;
  232. }
  233.  
  234. # web file
  235. server {
  236.     ssl_certificate /home/peter/web/home_shabbyserver_com_chain.crt;
  237.     ssl_certificate_key /home/peter/web/home.shabbyserver.com.key;
  238.     listen 9211 ssl;
  239.     server_name home.shabbyserver.com;
  240.     location /{
  241.         proxy_pass http://127.0.0.1:9212;
  242.     }
  243. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement