Last active
August 20, 2021 17:41
-
-
Save dimitardanailov/5c0b4d76f3fe8981f908 to your computer and use it in GitHub Desktop.
Configuration for Laravel 5 application and Nginx
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 default deferred; | |
server_name laravel-application.com; | |
# http://nginx.org/en/docs/http/ngx_http_log_module.html#access_log | |
access_log /var/www/laravel-app/access.log; | |
error_log /var/www/laravel-app/error.log; | |
root /var/www/laravel-app/public/; | |
location / { | |
index index.html index.htm index.php; | |
try_files $uri $uri/ /index.php?$args; | |
} | |
# pass the PHP scripts to FastCGI server listening on /var/run/php5-fpm.sock | |
# https://www.digitalocean.com/community/tutorials/how-to-install-laravel-with-nginx-on-an-ubuntu-12-04-lts-vps | |
location ~ \.php$ { | |
try_files $uri /index.php =404; | |
# Each fastcgi application have different port | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include /etc/nginx/fastcgi_params; | |
# CORS settings | |
# http://enable-cors.org/server_nginx.html | |
# http://10.10.0.64 - It's my front end application | |
add_header 'Access-Control-Allow-Origin' 'http://10.10.0.64'; | |
add_header 'Access-Control-Allow-Credentials' 'true'; | |
add_header 'Access-Control-Allow-Methods' 'GET, POST, DELETE, PUT'; | |
add_header 'Access-Control-Allow-Headers' 'Version,Accept,Accept-Encoding,Accept-Language,Connection,Coockie,Authorization,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is not a cache implemented here could you update this 😄