Haikson

Untitled

Apr 13th, 2016
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 4.08 KB | None | 0 0
  1. /etc/nginx/sites-enabled/default
  2.  
  3.     server {
  4.         listen 80 default_server;
  5.         listen [::]:80 default_server ipv6only=on;
  6.  
  7.         root /usr/share/nginx/html;
  8.         index index.html index.htm;
  9.  
  10.         # Make site accessible from http://localhost/
  11.         server_name localhost;
  12.  
  13.         location / {
  14.             # First attempt to serve request as file, then
  15.             # as directory, then fall back to displaying a 404.
  16.             try_files $uri $uri/ =404;
  17.             # Uncomment to enable naxsi on this location
  18.             # include /etc/nginx/naxsi.rules
  19.         }
  20.  
  21.         # Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
  22.         #location /RequestDenied {
  23.         #       proxy_pass http://127.0.0.1:8080;
  24.         #}
  25.  
  26.         #error_page 404 /404.html;
  27.  
  28.         # redirect server error pages to the static page /50x.html
  29.         #
  30.         #error_page 500 502 503 504 /50x.html;
  31.         #location = /50x.html {
  32.         #       root /usr/share/nginx/html;
  33.         #}
  34.  
  35.         # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  36.         #
  37.         #location ~ \.php$ {
  38.         #       fastcgi_split_path_info ^(.+\.php)(/.+)$;
  39.         #       # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
  40.         #
  41.         #       # With php5-cgi alone:
  42.         #       fastcgi_pass 127.0.0.1:9000;
  43.         #       # With php5-fpm:
  44.         #       fastcgi_pass unix:/var/run/php5-fpm.sock;
  45.         #       fastcgi_index index.php;
  46.         #       include fastcgi_params;
  47.         #}
  48.  
  49.         # deny access to .htaccess files, if Apache's document root
  50.         # concurs with nginx's one
  51.         #
  52.         #location ~ /\.ht {
  53.         #       deny all;
  54.         #}
  55.     }
  56.  
  57.  
  58.     upstream wsgi_mydomain.ru {
  59.        server unix:/srv/socks/mydomain.ru.sock;
  60.     }
  61.  
  62. /etc/nginx/sites-enabled/mydomain.conf
  63.  
  64.     server {
  65.         listen      80;
  66.         server_name mydomain.ru;
  67.         charset     utf8;
  68.         autoindex   off;
  69.         access_log  /srv/logs/mydomain.ru_access.log;
  70.         error_log   /srv/logs/mydomain.ru_error.log error;
  71.  
  72.         set         $project_home       /srv/www/mydomain.ru;
  73.         set         $media_home      /srv/www/httpdocs;
  74.  
  75.         root        $project_home;
  76.  
  77.  
  78.         location / {
  79.             root            $project_home;
  80.             try_files       $uri    @webadm;
  81.         }
  82.  
  83.         location /images {
  84.             root          $media_home/media;
  85.             expires       1w;
  86.         }
  87.  
  88.         location /img {
  89.             root            $media_home/media;
  90.             expires         1w;
  91.         }
  92.  
  93.         location /css {
  94.             root          $media_home/media;
  95.             expires       1d;
  96.         }
  97.  
  98.         location /js {
  99.             root          $media_home/media;
  100.             expires       1d;
  101.         }
  102.         location /fonts {    
  103.             root          $media_home/media;
  104.             expires       1w;
  105.  
  106.         }
  107.         location /files {
  108.             root            $media_home/media;
  109.             expires         1w;
  110.         }
  111.  
  112.         location /static {
  113.             root            $media_home;
  114.             expires         1d;
  115.         }
  116.  
  117.         location /media {
  118.             root            $media_home;
  119.             expires         1w;
  120.         }
  121.  
  122.         gzip             on;
  123.         gzip_min_length  1000;
  124.         gzip_proxied     expired no-cache no-store private auth;
  125.         gzip_disable     "MSIE [1-6]\.(?!.*SV1)";
  126.         gzip_static      on;
  127.         gzip_types       text/plain application/xml text/css application/javascript application/x-javascript text/javascript application/x-woff image/gif image/jpeg image/pjpeg image/png;
  128.  
  129.         location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|css|js)$ {
  130.             expires 7d;
  131.         }
  132.  
  133.         location @webadm {
  134.             uwsgi_pass              wsgi_mydomain.ru;
  135.             uwsgi_read_timeout      2400;
  136.             include                 uwsgi_params;
  137.         }
  138.     }
Advertisement
Add Comment
Please, Sign In to add comment