Facebook
From ja, 6 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 283
  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. # http://wiki.nginx.org/Pitfalls
  5. # http://wiki.nginx.org/QuickStart
  6. # http://wiki.nginx.org/Configuration
  7. #
  8. # Generally, you will want to move this file somewhere, and start with a clean
  9. # file but keep this around for reference. Or just disable in sites-enabled.
  10. #
  11. # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
  12. ##
  13.  
  14. # Default server configuration
  15. #
  16. server {
  17.         listen 80 default_server;
  18.         listen [::]:80 default_server;
  19.  
  20.         # SSL configuration
  21.         #
  22.         # listen 443 ssl default_server;
  23.         # listen [::]:443 ssl default_server;
  24.         #
  25.         # Self signed certs generated by the ssl-cert package
  26.         # Don't use them in a production server!
  27.         #
  28.         # include snippets/snakeoil.conf;
  29.  
  30.         root /var/www/html;
  31.  
  32.         # Add index.php to the list if you are using PHP
  33.         index index.html index.htm index.php;
  34.         autoindex on;
  35. # PHP in home directory
  36.         location ~ ^/~(.+?)(/.*.php)(.*)$ {
  37.         alias /home/$1/public_html;
  38.  
  39.         try_files $2 =404;
  40.         fastcgi_split_path_info ^(.+.php)(.*)$;
  41.         fastcgi_pass unix:/var/run/php5-fpm.sock;
  42.         fastcgi_index index.php;
  43.         fastcgi_intercept_errors on;
  44.         include fastcgi_params;
  45.  
  46.         fastcgi_param SCRIPT_NAME /~$1$fastcgi_script_name;
  47.         }
  48.  
  49. # Home directories
  50.         location ~ ^/~(.+?)(/.*)?$ {
  51.         alias /home/$1/public_html$2;
  52.         }
  53.  
  54.         server_name grupajsmb.pl;
  55.  
  56.         location / {
  57.                 # First attempt to serve request as file, then
  58.                 # as directory, then fall back to displaying a 404.
  59.                 try_files $uri $uri/ =404;
  60.         }
  61.  
  62.         # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  63.         #
  64.  
  65. #PHP ON
  66.         location ~ .php$ {
  67.                 include snippets/fastcgi-php.conf;
  68.         #
  69.         #       # With php5-cgi alone:
  70.         #       try_files $uri =404;
  71.         #       fastcgi_pass 127.0.0.1:9000;
  72.         #       fastcgi_index index.php;
  73.                 include fastcgi_params;
  74.                 fastcgi_pass 127.0.0.1:9000;
  75.         #       # With php5-fpm:
  76.         #       fastcgi_pass unix:/var/run/php5-fpm.sock;
  77.         }
  78.  
  79.         # deny access to .htaccess files, if Apache's document root
  80.         # concurs with nginx's one
  81.         #
  82.         #location ~ /.ht {
  83.         #       deny all;
  84.         #}
  85. }
  86.  
  87.  
  88. # Virtual Host configuration for example.com
  89. #
  90. # You can move that to a different file under sites-available/ and symlink that
  91. # to sites-enabled/ to enable it.
  92. #
  93. #server {
  94. #       listen 80;
  95. #       listen [::]:80;
  96. #
  97. #       server_name example.com;
  98. #
  99. #       root /var/www/example.com;
  100. #       index index.html;
  101. #
  102. #       location / {
  103. #               try_files $uri $uri/ =404;
  104. #       }
  105. #}
  106.