Advertisement
Guest User

yii + WP on one domen

a guest
Feb 13th, 2015
360
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 4.25 KB | None | 0 0
  1. server {
  2.         listen 80;
  3.         server_name  dev.goprotect.ru;
  4.  
  5.         root /srv/dev/frontend/www;
  6.         set $blog_path /srv/blog/wordpress;
  7.  
  8.         access_log /srv/dev_access.log;
  9.         error_log /srv/dev_error.log;
  10.  
  11.         index index.html index.php;
  12.  
  13.  
  14.         location /blog/ {
  15.             alias /srv/blog/wordpress/;
  16.         }
  17.        
  18.         location ~ /\.ht {
  19.             deny all;
  20.         }
  21.  
  22.         location = /favicon.ico {
  23.             log_not_found off;
  24.             access_log off;
  25.         }
  26.  
  27.         location = /robots.txt {
  28.             allow all;
  29.             log_not_found off;
  30.             access_log off;
  31.         }
  32.         location / {
  33.             auth_basic "Unauthorized";
  34.             auth_basic_user_file /srv/dev_passwd;
  35.             try_files $uri $uri/ /index.php?$args;
  36.         }
  37.        
  38.         location ~* /blog/(?:uploads|files)/.*\.php$ {
  39.             deny all;
  40.         }
  41.        
  42.         location ~ /blog/.*\.php$ {
  43.             fastcgi_split_path_info ^/blog(.+\.php)(.*)$;
  44.             #set $request_filename $blog_path$fastcgi_script_name;
  45.             if (!-f $blog_path$fastcgi_script_name) {
  46.                 return 200 ["WTF?"]$blog_path$fastcgi_script_name[$request_filename][$request_uri][$document_uri];
  47.             }
  48.             #try_files $uri $uri/ /index.php?$args;
  49.             # This is a robust solution for path info security issue and works with "cgi.fix_pathinfo = 1" in /etc/php.ini (default)
  50.  
  51.             #include /etc/nginx/fastcgi_params;
  52.             fastcgi_param    QUERY_STRING        $query_string;
  53.             fastcgi_param   REQUEST_METHOD        $request_method;
  54.             fastcgi_param   CONTENT_TYPE          $content_type;
  55.             fastcgi_param   CONTENT_LENGTH        $content_length;
  56.  
  57.             fastcgi_param   SCRIPT_FILENAME        $blog_path$fastcgi_script_name;
  58.             fastcgi_param   SCRIPT_NAME           $fastcgi_script_name;
  59.             fastcgi_param   REQUEST_URI           $request_uri;
  60.             fastcgi_param   DOCUMENT_URI          $document_uri;
  61.             fastcgi_param   DOCUMENT_ROOT           $blog_path;
  62.             fastcgi_param   SERVER_PROTOCOL        $server_protocol;
  63.  
  64.             fastcgi_param    GATEWAY_INTERFACE    CGI/1.1;
  65.             fastcgi_param    SERVER_SOFTWARE        nginx/$nginx_version;
  66.  
  67.             fastcgi_param    REMOTE_ADDR        $remote_addr;
  68.             fastcgi_param    REMOTE_PORT        $remote_port;
  69.             fastcgi_param    SERVER_ADDR        $server_addr;
  70.             fastcgi_param    SERVER_PORT        $server_port;
  71.             fastcgi_param    SERVER_NAME        $server_name;
  72.  
  73.             fastcgi_param    HTTPS            $https;
  74.             fastcgi_pass unix:/var/run/php5-fpm.sock;
  75.             fastcgi_index index.php;
  76.             fastcgi_param APPLICATION_ENV dev;
  77.         }
  78.  
  79.         location ~ \.php$ {
  80.             try_files $uri =404;
  81.  
  82.             fastcgi_param    QUERY_STRING        $query_string;
  83.             fastcgi_param   REQUEST_METHOD        $request_method;
  84.             fastcgi_param   CONTENT_TYPE          $content_type;
  85.             fastcgi_param   CONTENT_LENGTH        $content_length;
  86.  
  87.             fastcgi_param   SCRIPT_FILENAME        $request_filename;
  88.             fastcgi_param   SCRIPT_NAME           $fastcgi_script_name;
  89.             fastcgi_param   REQUEST_URI           $request_uri;
  90.             fastcgi_param   DOCUMENT_URI          $document_uri;
  91.             fastcgi_param   DOCUMENT_ROOT           $document_root;
  92.             fastcgi_param   SERVER_PROTOCOL        $server_protocol;
  93.  
  94.             fastcgi_param    GATEWAY_INTERFACE    CGI/1.1;
  95.             fastcgi_param    SERVER_SOFTWARE        nginx/$nginx_version;
  96.  
  97.             fastcgi_param    REMOTE_ADDR        $remote_addr;
  98.             fastcgi_param    REMOTE_PORT        $remote_port;
  99.             fastcgi_param    SERVER_ADDR        $server_addr;
  100.             fastcgi_param    SERVER_PORT        $server_port;
  101.             fastcgi_param    SERVER_NAME        $server_name;
  102.             fastcgi_pass unix:/var/run/php5-fpm.sock;
  103.             fastcgi_index index.php;
  104.             fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  105.             fastcgi_param APPLICATION_ENV dev;
  106.         }
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement