Difference between revisions of "OS4X with nginx"

From OS4X
Jump to navigation Jump to search
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
== PHP installation ==
 
== PHP installation ==
 
PHP must be installed as "FastCGI Process Manager" process:
 
PHP must be installed as "FastCGI Process Manager" process:
  apt-get install php5-fpm
+
  apt-get install php-fpm
  
 
== Nginx configuration ==
 
== Nginx configuration ==
Line 8: Line 8:
 
<pre>
 
<pre>
 
server {
 
server {
        root /var/www;
+
    listen 80;
 +
    root /var/www/html;
  
        index index.php index.html;
+
    index index.html index.htm index.php;
  
         location ~ /os4xapi/index\.php.* {
+
    location / {
                include fastcgi_params;
+
         try_files $uri $uri/ =404;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
+
    }
                fastcgi_index index.php;
+
 
                fastcgi_param  SCRIPT_FILENAME $document_root/os4x/os4xapi/index.php;
+
    location ~ \.php.* {
        }
+
        include snippets/fastcgi-php.conf;
        location ~ index\.php.* {
+
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
                include fastcgi_params;
+
    }
                fastcgi_pass unix:/var/run/php5-fpm.sock;
+
 
        }
+
    location ~ /\.ht {
 +
        deny all;
 +
    }
 
}
 
}
 
</pre>
 
</pre>

Latest revision as of 10:24, 6 November 2020

PHP installation

PHP must be installed as "FastCGI Process Manager" process:

apt-get install php-fpm

Nginx configuration

In order to make the OS4X web interface(s) work with nginx, you have to configure the server correctly. Such a configuration for the administrative web interface can be:

server {
    listen 80;
    root /var/www/html;

    index index.html index.htm index.php;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php.* {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
     }

    location ~ /\.ht {
        deny all;
    }
}