Skip to content

Instantly share code, notes, and snippets.

@rajivseelam
Created October 6, 2015 18:43
Show Gist options
  • Select an option

  • Save rajivseelam/ee8ca02db2049ac9a5cf to your computer and use it in GitHub Desktop.

Select an option

Save rajivseelam/ee8ca02db2049ac9a5cf to your computer and use it in GitHub Desktop.
Wordpress and Laravel In Sibling Directories - NGINX
server {
server_name selldev.com;
access_log /home/rajiv/Projects/sellulose/storage/logs/access.log;
error_log /home/rajiv/Projects/sellulose/storage/logs/error.log;
index index.html index.htm index.php;
root /home/rajiv/Projects/sellulose/public;
index index.php index.html;
location / {
try_files $uri $uri/ @ci;
}
# create the code igniter path and perform
# internal redirect to php location block
location @ci {
if (!-e $request_filename)
{
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
}
# now the meaty part, execute php scripts
location ~ \.php {
include fastcgi_params;
set $php_root /home/rajiv/Projects/sellulose/public;
if ($request_uri ~ /wordpress) {
set $php_root /home/rajiv/Projects;
}
if ($request_uri ~ /wordpress/) {
set $php_root /home/rajiv/Projects;
}
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $php_root$fastcgi_script_name;
}
location ~ /wordpress {
root /home/rajiv/Projects;
index index.html index.htm index.php;
if (!-e $request_filename)
{
rewrite ^/wordpress/(.+)$ /wordpress/index.php?q=$1 last;
}
}
location ~ /wordpress/ {
root /home/rajiv/Projects;
if (!-e $request_filename)
{
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
}
location ~* .(jpg|jpeg|png|gif|ico|css|js)$ {
expires 7d;
add_header Pragma public;
add_header Cache-Control "public";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment