Max2Play Home › Forums › Max2Play Development (Ideas, Wishes) › MAX2PLAY on nginx › Reply To: MAX2PLAY on nginx
27. März 2019 at 15:53
#44908
# Stop Apache First if running
/etc/init.d/apache2 stop
# Install NGINX and Packages for PHP 7
apt-get install php-fpm php-simplexml nginx -y
# Use Upgraded NGINX Max2Play File with new PHP 7 Socket
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/php/php7.0-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;
}
}
Have Fun!