Welcome! Log In Create A New Profile

Advanced

Nginx multiple php sites

July 15, 2014 09:15AM
Hi,
I've been searching (last two days) to find how to setup multiple php sites using nginx. Couldn't find any documentation around it, hence writing it here.
I've two codeignetor (php framework) in two different folders and served from same domain. For an example,

example.com => /var/www/example/index.php
example.com/blog => /var/www/example/blog/index.php

I made the first one to work using the following code. Can someone help me to modify this config to fit the second requirement?!
(the configurations I tried doesn't pass the query strings - hence pasting the working version)

server {
listen 80;
server_name example.com;

location / {
root /var/www/example/;
try_files $uri $uri/ /index.php?$args;
index index.php index.html index.htm;
}

location ~^ \.php$ {
root /var/www/example/;
fastcgi_pass 127.0.0.1:9000;
index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

Thanks in advance.
Subject Author Posted

Nginx multiple php sites

devsathish July 15, 2014 09:15AM

Re: Nginx multiple php sites

Anoop Alias July 15, 2014 10:30AM

Re: Nginx multiple php sites

Anoop Alias July 15, 2014 10:32AM

Re: Nginx multiple php sites

B.R. July 15, 2014 12:18PM

Re[2]: Nginx multiple php sites

artem July 15, 2014 02:00PM

Re: Re[2]: Nginx multiple php sites

B.R. July 15, 2014 03:44PM

Re: Nginx multiple php sites

Francis Daly July 18, 2014 10:40AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 296
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready