Skip to content

Instantly share code, notes, and snippets.

@winwu
Last active January 24, 2021 17:09
Show Gist options
  • Save winwu/e7f3330c220f4263de00 to your computer and use it in GitHub Desktop.
Save winwu/e7f3330c220f4263de00 to your computer and use it in GitHub Desktop.
laravel nginx config file with apache
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/YOUR_PROJECT/public;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name YOUR_IP_OR_DOMAIN;
access_log /var/log/nginx/localhost.laravel-access.log;
error_log /var/log/nginx/locahost.laravel-error.log error;
location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
try_files $uri =404;
}
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:8080;
}
location ~* ^.*\.php$ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:8080;
}
location ~ /\.(ht|git) {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment