Nginx Configuration

In order to get pH7Builder working on nginx server, you need to add some custom nginx configuration.

Create "/etc/nginx/ph7cms.conf" and add the following:


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

Please note that the above code is the strict minimum and obviously you can add more by comparing with the main Apache .htaccess file

Now in your nginx server configuration you will have to include `ph7cms.conf` file to complete the configuration like below:

In file, e.g., "/etc/nginx/sites-enabled/yoursite.conf" for Ubuntu and other OS based on Debian or "/etc/nginx/conf.d/yoursite.conf" for CentOS, Fedora and other OS based on Red Hat.


server {
    # Port number. In most cases, 80 for HTTP and 443 for HTTPS
    listen 80;

    server_name www.yoursite.com;
    root /var/www/ph7cms_public_root;
    index index.php; #you can use index.ph7; for hidding the *.php ...
    client_max_body_size 50M;

    error_log /var/log/nginx/yoursite.error.log;
    access_log /var/log/nginx/yoursite.access.log;

    # Include ph7cms.conf. You can also directly add the "location" rule instead of including the conf file
    include /etc/nginx/ph7cms.conf;
}

For more information, please refer to the nginx documentation.

 


📝 Found a typo/something to add? Edit this Page ✍️

GitHub