Last active
January 30, 2018 16:11
-
-
Save emmanuelbarturen/96ea9dfa8e73bff2d4bdb5b4b82a8d57 to your computer and use it in GitHub Desktop.
Nginx Config for wordpress and laravel in the same server/hosting. How to put a wordpress in a laravel project. Wordpress folder, named blog, is inner public directory of laravel
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 { | |
listen 80 default_server; | |
listen [::]:80 default_server ipv6only=on; | |
root /var/www/laravel-project/public; | |
index index.php index.html index.htm; | |
server_name laravelProject.com www.laravelProject.com; | |
charset utf-8; | |
location /blog/index.php(/.*)?$ { | |
fastcgi_split_path_info ^(/blog/index.php)(/.+)$; | |
fastcgi_pass unix:/var/run/php7.1-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_read_timeout 1000; | |
fastcgi_param PATH_INFO $fastcgi_path_info; | |
include fastcgi_params; | |
} | |
location /blog/ { | |
if (!-e $request_filename) { | |
rewrite ^.*$ /blog/index.php last; | |
} | |
try_files $uri $uri/ blog/index.php?args; | |
} | |
location / { | |
try_files $uri $uri/ /index.php?$query_string; | |
} | |
error_page 404 /404.html; | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
root /usr/share/nginx/html; | |
} | |
location ~ \.php$ { | |
include snippets/fastcgi-php.conf; | |
fastcgi_pass unix:/run/php/php7.0-fpm.sock; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment