Created
August 9, 2018 09:03
-
-
Save ansulev/6bd8b833360dbd7a051a8b732bf72aae to your computer and use it in GitHub Desktop.
Laravel Website Configuration NGINX
This file contains 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 { | |
# Port that the web server will listen on. | |
listen 80; | |
# Host that will serve this project. | |
server_name app.dev; | |
# Useful logs for debug. | |
access_log /path/to/access.log; | |
error_log /path/to/error.log; | |
rewrite_log on; | |
# The location of our projects public directory. | |
root /path/to/our/public; | |
# Point index to the Laravel front controller. | |
index index.php; | |
location / { | |
# URLs to attempt, including pretty ones. | |
try_files $uri $uri/ /index.php?$query_string; | |
} | |
# Remove trailing slash to please routing system. | |
if (!-d $request_filename) { | |
rewrite ^/(.+)/$ /$1 permanent; | |
} | |
# PHP FPM configuration. | |
location ~* \.php$ { | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_split_path_info ^(.+\.php)(.*)$; | |
include /etc/nginx/fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
} | |
# We don't need .ht files with nginx. | |
location ~ /\.ht { | |
deny all; | |
} | |
# Set header expirations on per-project basis | |
location ~* \.(?:ico|css|js|jpe?g|JPG|png|svg|woff)$ { | |
expires 365d; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment