Skip to content

Instantly share code, notes, and snippets.

@BlackMetalz
Created August 15, 2020 04:51
Show Gist options
  • Save BlackMetalz/f3afedf48ae8fc4e4cb22239b6fbea30 to your computer and use it in GitHub Desktop.
Save BlackMetalz/f3afedf48ae8fc4e4cb22239b6fbea30 to your computer and use it in GitHub Desktop.
Laravel and wordpress config in same site
server {
listen 80;
server_name blackcms.local;
root /var/www/wordpress;
index index.php index.html index.htm;
client_max_body_size 200m;
access_log /var/log/nginx/app_access.log;
error_log /var/log/nginx/app_error.log;
set $upstream_endpoint 127.0.0.1:9000;
location / {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?$query_string;
}
location ^~ /laravel {
alias /var/www/wordpress/laravel/public;
try_files $uri $uri/ @laravel;
location ~ \.php {
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
}
location @laravel {
rewrite /laravel/(.*)$ /laravel/index.php?/$1 last;
}
location ~* \.php$ {
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment