Advertisement
Guest User

Nginx PHP vhost

a guest
Jul 27th, 2015
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 0.88 KB | None | 0 0
  1.  
  2. server {
  3.     listen 80;
  4.     server_name www.domain.com;
  5.     return 301 $scheme://domain.com$request_uri;
  6. }
  7.  
  8. server {
  9.     listen *:80;
  10.     server_name domain.com;
  11.     root /path/to/domain.com;
  12.  
  13.     index index.html index.htm index.php;
  14.     charset utf-8;
  15.     location / {
  16.         try_files $uri $uri/ index.php$is_args$args;
  17.     }
  18.     location ~ \.php$ {
  19.         try_files $uri /index.php =404;
  20.         fastcgi_pass unix:/var/run/php5-fpm.sock;
  21.         fastcgi_index index.php;
  22.         fastcgi_split_path_info ^(.+\.php)(.*)$;
  23.         include fastcgi_params;
  24.         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  25.     }
  26.     location ~ /\. {
  27.         deny  all;
  28.         access_log off;
  29.         log_not_found off;
  30.     }
  31.     location = /favicon.ico { log_not_found off; access_log off; }
  32.     location = /robots.txt { log_not_found off; access_log off; }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement