Skip to content

Instantly share code, notes, and snippets.

@endrureza
Created October 4, 2016 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save endrureza/df7c0971e429be5a3c68ac9821f463d0 to your computer and use it in GitHub Desktop.
Save endrureza/df7c0971e429be5a3c68ac9821f463d0 to your computer and use it in GitHub Desktop.
Refix Virtualhost Create for Nginx
server {
listen 80;
listen [::]:80;
server_name scheduling.dev;
root /var/www/html/scheduling/public;
index index.php index.html index.htm;
# serve static files directly
location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
access_log off;
expires max;
}
# removes trailing slashes (prevents SEO duplicate content issues)
if (!-d $request_filename) {
rewrite ^/(.+)/$ /$1 permanent;
}
# unless the request is for a valid file (image, js, css, etc.), send to bootstrap
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?/$1 last;
break;
}
# removes trailing 'index' from all controllers
if ($request_uri ~* index/?$) {
rewrite ^/(.*)/index/?$ /$1 permanent;
}
# catch all
#error_page 404 /index.php;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# fastcgi_split_path_info ^(.+\.php)(/.+)$;
# #fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
# fastcgi_index index.php;
# include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment