-
-
Save mrstevekim/74ff9cf9d6716edc1acead1992812ca3 to your computer and use it in GitHub Desktop.
Example vhost config for Nginx (PHP)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| server { | |
| listen 80; | |
| server_name .example.co.uk.dev; | |
| access_log /usr/local/var/log/nginx/example.co.uk-access.log; | |
| error_log /usr/local/var/log/nginx/example.co.uk-error.log error; | |
| root /var/www/example.co.uk/public; | |
| index index.php index.html; | |
| location / { | |
| try_files $uri $uri/ /index.php?$query_string; | |
| } | |
| location ~ \.php { | |
| fastcgi_index index.php; | |
| fastcgi_pass unix:/usr/local/var/run/php-fpm.socket; | |
| include fastcgi_params; | |
| fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
| fastcgi_param PATH_INFO $fastcgi_path_info; | |
| fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; | |
| fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
| } | |
| # Prevents caching of css/less/js/images, only use this in development | |
| location ~* \.(css|less|js|jpg|png|gif)$ { | |
| add_header Cache-Control "no-cache, no-store, must-revalidate"; | |
| add_header Pragma "no-cache"; | |
| expires 0; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment