Yii Framework Forum: Yii Is Making Me Sad - Yii Framework Forum

Jump to content

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

Yii Is Making Me Sad Rate Topic: -----

#1 User is offline   deadlyone 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 11-February 14

Posted 12 February 2014 - 01:53 AM

I wanted to learn YII.

But For 2 days i'm trying to setup nginx (+ubuntu +php-fpm) for yii. Unsuccessfully of course - every configs for nginx, even these founded on yiiframework.com FAILS (booom!). Throwing errors or just not working properly with demo app.

Can somebody help me, paste WORKING config for nginx or should i visit fuelphp website?
0

#2 User is offline   thelfensdrfer 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 37
  • Joined: 06-March 11
  • Location:Germany

Posted 15 April 2014 - 04:16 AM

What exactly fails? Where are your errors? Do simple php scripts work? Is there a routing problem?

This is my nginx.conf:


user _www;
worker_processes  1;

events {
	worker_connections  1024;
}

http {
	include					mime.types;
	default_type			application/octet-stream;

	client_max_body_size	100M;

	sendfile        on;
	keepalive_timeout  65;

	gzip  on;

	server {
		listen   	80;
		server_name  localhost;
		autoindex	on;
		index 		index.html index.htm index.php;

		charset utf-8;

		location / {
			root   /usr/local/var/www;
			index  index.html index.htm index.php;
		}

		location ~ \.php$ {
			fastcgi_pass   127.0.0.1:9000;
			fastcgi_index  index.php;
			fastcgi_read_timeout 3600;
			include        fastcgi_params;
			fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
		}

		location ~ /\.ht {
			deny  all;
		}

		include vhosts/*.conf;
	}
}



And this is a sample vhost.conf in vhosts/*.conf:

location /www/project {
    try_files $uri $uri/ /www/project/index.php?$args;
}


Everytime I create a new yii/wordpress project with nice urls, all i have to do is copy this 3 lines to a new file and reload nginx. Works with ubuntu and mac os x and php-fpm 5.3 - 5.5
0

#3 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,738
  • Joined: 17-January 09
  • Location:Russia

Posted 23 April 2014 - 08:20 AM

Well, it's nginx making you sad, not Yii.

I'm using the following (with latest stable nginx built from sources):


nginx.conf
worker_processes 1;

error_log  logs/error.log  warn;
pid        logs/nginx.pid;

events {
    worker_connections  1024;
}

http {
    server_names_hash_bucket_size 64;

    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    keepalive_timeout  65;

    gzip  on;
    charset utf-8;
	
    index index.php index.htm index.html;
	
    include vhosts/*.conf;
}


vhosts/yii2.conf (you can create as many .conf files as you want there, it will read all these)

server {
	listen       80;
	server_name  yii2-basic.local;
	root	/dev/yii2-basic-dev/web/;

	location / {
		try_files   $uri $uri/ /index.php?$args; # Redirect everything that isn't real file to index.php including arguments.
	}

	location ~ \.php$ {
		include fastcgi.conf;
		fastcgi_pass   127.0.0.1:9000;
	}

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


fastcgi.conf
fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  HTTPS              $https if_not_empty;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;

Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#4 User is offline   Hiawatha 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 29-May 14

Posted 29 May 2014 - 09:42 AM

If nginx is making you sad, try the Hiawatha web server. Success guaranteed! :rolleyes:


P.S.
This forum doesn't allow me to include a link in my post. Just google for Hiawatha web server. You'll find it.
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