Yii Framework Forum: How To Configure Yii2 Website With Nginx Location? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How To Configure Yii2 Website With Nginx Location? Rate Topic: -----

#1 User is offline   karminski 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 19-April 12
  • Location:Moscow, Russia

Posted 09 June 2014 - 08:45 AM

I have single domain (www.domain.com) and several Yii2-based web-sites. I need to configure Nginx to open each web-site in location, ex. www.domain.com/site1, with url rewrite support. Im using Debian 7.0.5. I could not use subdomains in this scenario.

My config is:
server {
	charset utf-8;
	client_max_body_size 128M;

	listen 80;
	root /var/www;
	index index.php;

	error_log /var/log/nginx/error.log debug;

	location /site1/ {
		alias /var/www/site1/web/;
		try_files $uri $uri/ /index.php?$args;

		location ~ ^/site1/(.+\.php)$ {
			include yii.conf;
			fastcgi_param SCRIPT_FILENAME /var/www/test/web/index.php;
		}
	}

	location ~ /\.(ht|svn|git) {
		deny all;
	}
}


Yii.conf file:
fastcgi_split_path_info ^(.+\.php)(/.+)$;

fastcgi_hide_header "X-Powered-CMS";
fastcgi_hide_header "X-Powered-By";

fastcgi_pass unix:/var/run/php5-fpm.sock;
include fastcgi_params;


Please help.
0

#2 User is offline   Keith Slater 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 25
  • Joined: 22-June 14

Posted 13 July 2014 - 04:58 PM

Did you ever get this figured out?
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users