plastyr

nginx conf

Oct 22nd, 2021 (edited)
487
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 8.64 KB | None | 0 0
  1. [user@server]# nginx -T && nginx -t && nginx -v
  2. nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
  3. nginx: configuration file /etc/nginx/nginx.conf test is successful
  4. # configuration file /etc/nginx/nginx.conf:
  5.  
  6. user  nginx;
  7. worker_processes  1;
  8.  
  9. error_log  /var/log/nginx/error.log warn;
  10. pid        /var/run/nginx.pid;
  11.  
  12.  
  13. events {
  14.     worker_connections  1024;
  15. }
  16.  
  17.  
  18. http {
  19.     include       /etc/nginx/mime.types;
  20.     default_type  application/octet-stream;
  21.  
  22.     log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
  23.                       '$status $body_bytes_sent "$http_referer" '
  24.                       '"$http_user_agent" "$http_x_forwarded_for"';
  25.  
  26.     access_log  /var/log/nginx/access.log  main;
  27.  
  28.     sendfile        on;
  29.     #tcp_nopush     on;
  30.  
  31.     keepalive_timeout  65;
  32.  
  33.     #gzip  on;
  34.  
  35.     include /etc/nginx/conf.d/*.conf;
  36. }
  37.  
  38. # configuration file /etc/nginx/mime.types:
  39.  
  40. types {
  41.     text/html                                        html htm shtml;
  42.     text/css                                         css;
  43.     text/xml                                         xml;
  44.     image/gif                                        gif;
  45.     image/jpeg                                       jpeg jpg;
  46.     application/javascript                           js;
  47.     application/atom+xml                             atom;
  48.     application/rss+xml                              rss;
  49.  
  50.     text/mathml                                      mml;
  51.     text/plain                                       txt;
  52.     text/vnd.sun.j2me.app-descriptor                 jad;
  53.     text/vnd.wap.wml                                 wml;
  54.     text/x-component                                 htc;
  55.  
  56.     image/png                                        png;
  57.     image/svg+xml                                    svg svgz;
  58.     image/tiff                                       tif tiff;
  59.     image/vnd.wap.wbmp                               wbmp;
  60.     image/webp                                       webp;
  61.     image/x-icon                                     ico;
  62.     image/x-jng                                      jng;
  63.     image/x-ms-bmp                                   bmp;
  64.  
  65.     font/woff                                        woff;
  66.     font/woff2                                       woff2;
  67.  
  68.     application/java-archive                         jar war ear;
  69.     application/json                                 json;
  70.     application/mac-binhex40                         hqx;
  71.     application/msword                               doc;
  72.     application/pdf                                  pdf;
  73.     application/postscript                           ps eps ai;
  74.     application/rtf                                  rtf;
  75.     application/vnd.apple.mpegurl                    m3u8;
  76.     application/vnd.google-earth.kml+xml             kml;
  77.     application/vnd.google-earth.kmz                 kmz;
  78.     application/vnd.ms-excel                         xls;
  79.     application/vnd.ms-fontobject                    eot;
  80.     application/vnd.ms-powerpoint                    ppt;
  81.     application/vnd.oasis.opendocument.graphics      odg;
  82.     application/vnd.oasis.opendocument.presentation  odp;
  83.     application/vnd.oasis.opendocument.spreadsheet   ods;
  84.     application/vnd.oasis.opendocument.text          odt;
  85.     application/vnd.openxmlformats-officedocument.presentationml.presentation
  86.                                                      pptx;
  87.     application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
  88.                                                      xlsx;
  89.     application/vnd.openxmlformats-officedocument.wordprocessingml.document
  90.                                                      docx;
  91.     application/vnd.wap.wmlc                         wmlc;
  92.     application/x-7z-compressed                      7z;
  93.     application/x-cocoa                              cco;
  94.     application/x-java-archive-diff                  jardiff;
  95.     application/x-java-jnlp-file                     jnlp;
  96.     application/x-makeself                           run;
  97.     application/x-perl                               pl pm;
  98.     application/x-pilot                              prc pdb;
  99.     application/x-rar-compressed                     rar;
  100.     application/x-redhat-package-manager             rpm;
  101.     application/x-sea                                sea;
  102.     application/x-shockwave-flash                    swf;
  103.     application/x-stuffit                            sit;
  104.     application/x-tcl                                tcl tk;
  105.     application/x-x509-ca-cert                       der pem crt;
  106.     application/x-xpinstall                          xpi;
  107.     application/xhtml+xml                            xhtml;
  108.     application/xspf+xml                             xspf;
  109.     application/zip                                  zip;
  110.  
  111.     application/octet-stream                         bin exe dll;
  112.     application/octet-stream                         deb;
  113.     application/octet-stream                         dmg;
  114.     application/octet-stream                         iso img;
  115.     application/octet-stream                         msi msp msm;
  116.  
  117.     audio/midi                                       mid midi kar;
  118.     audio/mpeg                                       mp3;
  119.     audio/ogg                                        ogg;
  120.     audio/x-m4a                                      m4a;
  121.     audio/x-realaudio                                ra;
  122.  
  123.     video/3gpp                                       3gpp 3gp;
  124.     video/mp2t                                       ts;
  125.     video/mp4                                        mp4;
  126.     video/mpeg                                       mpeg mpg;
  127.     video/quicktime                                  mov;
  128.     video/webm                                       webm;
  129.     video/x-flv                                      flv;
  130.     video/x-m4v                                      m4v;
  131.     video/x-mng                                      mng;
  132.     video/x-ms-asf                                   asx asf;
  133.     video/x-ms-wmv                                   wmv;
  134.     video/x-msvideo                                  avi;
  135. }
  136.  
  137. # configuration file /etc/nginx/conf.d/default.conf:
  138. server {listen 80;
  139.         server_name localhost;
  140.                 root /usr/share/zabbix;
  141.                
  142.                 location / {index index.php index.html index.htm;}
  143.                
  144.                 location ~ \.php$ {
  145.                 fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
  146.                 fastcgi_index index.php;
  147.                 fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
  148.                 include fastcgi_params;
  149.                 fastcgi_param PHP_VALUE "
  150.                max_execution_time = 300
  151.                memory_limit = 128M
  152.                post_max_size = 16M
  153.                upload_max_filesize = 2M
  154.                max_input_time = 300
  155.                date.timezone = Asia/Yekaterinburg
  156.                always_populate_raw_post_data = -1
  157.                ";
  158.                 fastcgi_buffers 8 256k;
  159.                 fastcgi_buffer_size 128k;
  160.                 fastcgi_intercept_errors on;
  161.                 fastcgi_busy_buffers_size 256k;
  162.                 fastcgi_temp_file_write_size 256k;
  163.                 }
  164.                
  165.  
  166.         location /test { #new url path
  167.         alias /mnt/test-dir-for-nginx; #directory to list
  168.         autoindex on;
  169.  
  170.         location ~ \.info {
  171.             deny all;
  172.         }  
  173.        
  174.         }
  175.         }
  176.  
  177.  
  178. # configuration file /etc/nginx/fastcgi_params:
  179.  
  180. fastcgi_param  QUERY_STRING       $query_string;
  181. fastcgi_param  REQUEST_METHOD     $request_method;
  182. fastcgi_param  CONTENT_TYPE       $content_type;
  183. fastcgi_param  CONTENT_LENGTH     $content_length;
  184.  
  185. fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
  186. fastcgi_param  REQUEST_URI        $request_uri;
  187. fastcgi_param  DOCUMENT_URI       $document_uri;
  188. fastcgi_param  DOCUMENT_ROOT      $document_root;
  189. fastcgi_param  SERVER_PROTOCOL    $server_protocol;
  190. fastcgi_param  REQUEST_SCHEME     $scheme;
  191. fastcgi_param  HTTPS              $https if_not_empty;
  192.  
  193. fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
  194. fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;
  195.  
  196. fastcgi_param  REMOTE_ADDR        $remote_addr;
  197. fastcgi_param  REMOTE_PORT        $remote_port;
  198. fastcgi_param  SERVER_ADDR        $server_addr;
  199. fastcgi_param  SERVER_PORT        $server_port;
  200. fastcgi_param  SERVER_NAME        $server_name;
  201.  
  202. # PHP only, required if PHP was built with --enable-force-cgi-redirect
  203. fastcgi_param  REDIRECT_STATUS    200;
  204.  
  205. nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
  206. nginx: configuration file /etc/nginx/nginx.conf test is successful
  207. nginx version: nginx/1.18.0
Add Comment
Please, Sign In to add comment