Advertisement
Guest User

nginx configuration

a guest
Oct 27th, 2015
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 3.58 KB | None | 0 0
  1. # You may add here your
  2. # server {
  3. #   ...
  4. # }
  5. # statements for each of your virtual hosts to this file
  6.  
  7. ##
  8. # You should look at the following URL's in order to grasp a solid understanding
  9. # of Nginx configuration files in order to fully unleash the power of Nginx.
  10. # http://wiki.nginx.org/Pitfalls
  11. # http://wiki.nginx.org/QuickStart
  12. # http://wiki.nginx.org/Configuration
  13. #
  14. # Generally, you will want to move this file somewhere, and start with a clean
  15. # file but keep this around for reference. Or just disable in sites-enabled.
  16. #
  17. # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
  18. ##
  19.  
  20. upstream django_server{
  21.     server 127.0.0.1:8000 fail_timeout=0;
  22. }
  23. # HTML SERVER VIVERESPARAISOCA.COM
  24. server {
  25.     listen 80 default_server;
  26.     listen [::]:80 default_server ipv6only=on;
  27.  
  28.     root /var/www/viveresparaiso.com/public_html;
  29.     index index.html index.htm;
  30.  
  31.     # Make site accessible from http://localhost/
  32.     server_name viverespara32.com www.viverespara32.com;
  33.  
  34.     location / {
  35.         # First attempt to serve request as file, then
  36.         # as directory, then fall back to displaying a 404.
  37.         try_files $uri $uri/ =404;
  38.         # Uncomment to enable naxsi on this location
  39.         # include /etc/nginx/naxsi.rules
  40.     }
  41.  
  42.     # Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
  43.     #location /RequestDenied {
  44.     #   proxy_pass http://127.0.0.1:8080;    
  45.     #}
  46.  
  47.     #error_page 404 /404.html;
  48.  
  49.     # redirect server error pages to the static page /50x.html
  50.     #
  51.     #error_page 500 502 503 504 /50x.html;
  52.     #location = /50x.html {
  53.     #   root /usr/share/nginx/html;
  54.     #}
  55.  
  56.     # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  57.     #
  58.     #location ~ \.php$ {
  59.     #   fastcgi_split_path_info ^(.+\.php)(/.+)$;
  60.     #   # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
  61.     #
  62.     #   # With php5-cgi alone:
  63.     #   fastcgi_pass 127.0.0.1:9000;
  64.     #   # With php5-fpm:
  65.     #   fastcgi_pass unix:/var/run/php5-fpm.sock;
  66.     #   fastcgi_index index.php;
  67.     #   include fastcgi_params;
  68.     #}
  69.  
  70.     # deny access to .htaccess files, if Apache's document root
  71.     # concurs with nginx's one
  72.     #
  73.     #location ~ /\.ht {
  74.     #   deny all;
  75.     #}
  76. }
  77. # DJANGO SERVER CUADRATUDIA.COM
  78. server {
  79.     listen 80;
  80.    
  81.         root /home/django/discotecas;
  82.         index /discotecas/wsgi.py;
  83.  
  84.         access_log /home/django/logs/access.log;
  85.  
  86.     client_max_body_size 4G;
  87.     server_name cuadratudia.com.ve
  88.    
  89.     keepalive_timeout 5;
  90.  
  91.         location /static/ {
  92.             #autoindex on;
  93.             #alias /home/django/discotecas/static/;
  94.             root /home/django/discotecas/;
  95.         }
  96.  
  97.         # Proxy the static assests for the Django Admin panel
  98.     location /static/admin {
  99.             alias /usr/lib/python2.7/dist-packages/django/contrib/admin/static/admin/;
  100.     }
  101.  
  102.     location / {   
  103.  
  104.             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  105.             proxy_set_header Host $http_host;
  106.             proxy_redirect off;
  107.             proxy_pass http://django_server;       
  108.     }
  109. }
  110.  
  111.  
  112.  
  113. # another virtual host using mix of IP-, name-, and port-based configuration
  114. #
  115. #server {
  116. #   listen 8000;
  117. #   listen somename:8080;
  118. #   server_name somename alias another.alias;
  119. #   root html;
  120. #   index index.html index.htm;
  121. #
  122. #   location / {
  123. #       try_files $uri $uri/ =404;
  124. #   }
  125. #}
  126.  
  127.  
  128. # HTTPS server
  129. #
  130. #server {
  131. #   listen 443;
  132. #   server_name localhost;
  133. #
  134. #   root html;
  135. #   index index.html index.htm;
  136. #
  137. #   ssl on;
  138. #   ssl_certificate cert.pem;
  139. #   ssl_certificate_key cert.key;
  140. #
  141. #   ssl_session_timeout 5m;
  142. #
  143. #   ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
  144. #   ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
  145. #   ssl_prefer_server_ciphers on;
  146. #
  147. #   location / {
  148. #       try_files $uri $uri/ =404;
  149. #   }
  150. #}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement