Reply To: MAX2PLAY on nginx

20. Oktober 2015 at 18:00 #16446

Hi Silver,

you may test nginx by installing it with

apt-get install php5-fpm nginx -y

using this config file for Max2Play:

server {
	listen   81; ## listen for ipv4; this line is default and implied
	#listen   [::]:80 default_server ipv6only=on; ## listen for ipv6

	root /var/www/max2play/public;
	index index.php;

	location / {
        error_page  404 = /index.php?q=$uri;
        log_not_found  off;
    }
	
	location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
        access_log off;
        expires 30d;
        root /var/www/max2play/public;
    }        

	# Rewrite rule
    if (!-e $request_filename) {
        rewrite ^(.*)$ /index.php?page=$1 last;
    }

	# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    location ~ \.php$ {
		fastcgi_pass   unix:/var/run/php5-fpm.sock;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /var/www/max2play/public$fastcgi_script_name;
		include fastcgi_params;
    }

	# deny access to .htaccess files, if Apache's document root
	# concurs with nginx's one
	location ~ /\.ht {
		deny all;
	}
}

Open the web interface with http://max2play:81 – the original apache web server is still running on Port 80. We did not test this yet – there may be some problems on nginx…

  • This reply was modified 8 years, 6 months ago by flysurfer.