Jump to content
Sign in to follow this  

Nginx config with error 500

Recommended Posts


Although I use a config on an other of my sites that works well. An error 500 is driving me nuts.
Coul someone have a look on my config

server {
        listen 80;
        server_name attente.xyz;
        rewrite ^ https://$server_name$request_uri? permanent;

server {
       listen 443 ssl;
        server_name attente.xyz;
      ssl_certificate /etc/letsencrypt/live/krouus.company/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/krouus.company/privkey.pem;

        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

         # Activer le ciphers et mettre ceux autorisés (je vous laisse faire de plus amples recherches pour ça ;) )
         ssl_prefer_server_ciphers on;
        ssl_session_cache shared:SSL:10m;
       ssl_session_timeout 10m;
         # La fameuse clé générée en dernier
       ssl_dhparam /etc/nginx/dhparam.pem;

         # Ajout d'une règle http
       add_header Strict-Transport-Security "max-age=31536000;";

        root /var/www/attente.xyz/html;
        index index.php index.html index.htm;

        location / {
        #               try_files $uri $uri/ /index.php?it=$uri&$args;
                        try_files $uri /index.php$is_args$args;
                fastcgi_pass unix:/run/php/php7.0-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_intercept_errors on;
                fastcgi_ignore_client_abort off;
                fastcgi_connect_timeout 60;
                fastcgi_send_timeout 180;
                fastcgi_read_timeout 180;
                fastcgi_buffers 4 256k;
                fastcgi_buffer_size 128k;
                fastcgi_busy_buffers_size 256k;
                fastcgi_temp_file_write_size 256k;
            location ~ \.php$ {
                #try_files $uri =404;
                include snippets/fastcgi-php.conf;
                include /etc/nginx/fastcgi_params;
                fastcgi_pass unix:/run/php/php7.0-fpm.sock;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                # .htaccess 10.
                fastcgi_param HTTP_MOD_REWRITE On;
                fastcgi_param X-Real-IP  $remote_addr;
                fastcgi_param X-Forwarded-For $remote_addr;
                fastcgi_param Host $host;
location ~* \.(?:css|gif|htc|ico|js|jpe?g|png|swf|svg|ttf|eot|woff|less|pdf)$ {
           #expires max;
           log_not_found off;
            ## No need to bleed constant updates. Send the all shebang in one
            ## fell swoop.
            tcp_nodelay off;
            ## Set the OS file cache.
            open_file_cache max=1000 inactive=120s;
            open_file_cache_valid 45s;
            open_file_cache_min_uses 2;
            open_file_cache_errors off;
            valid_referers attente.xyz;
            ##ajout ProcessWire
            expires 24h;
            #log_not_found off;
            access_log off;
            try_files $uri /index.php?it=$uri&$args;

# .htaccess 8.1
charset utf-8;

# .htaccess 3.
  location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { log_not_found off; access_log off; }

# .htaccess 4.
  # add_header X-Frame-Options SAMEORIGIN always; # Set by ProcessWire core
  add_header X-XSS-Protection "1; mode=block";
  # add_header X-Content-Type-Options "nosniff";

  # -----------------------------------------------------------------------------------------------
  # .htaccess 5.
  # -----------------------------------------------------------------------------------------------

  # Block access to ProcessWire system files
  location ~ \.(inc|info|info\.json|module|sh|sql)$ { deny all; }
  # Block access to composer files
  location ~ composer\.(json|lock)$ { deny all; }
  # Block access to any file or directory that begins with a period (except well-known)
location ~ (^|/)\.(?!well-known)|^\..*$ { deny all; }

  # -----------------------------------------------------------------------------------------------
  # .htaccess 15.
  # -----------------------------------------------------------------------------------------------

  # Block access to protected assets directories
  location ~ ^/(site|site-[^/]+)/assets/(cache|logs|backups|sessions|config|install|tmp)($|/.*$) { deny all; }
  # Block acceess to the /site/install/ directory
  location ~ ^/(site|site-[^/]+)/install($|/.*$) { deny all; }
  # Block dirs in /site/assets/ dirs that start with a hyphen
  location ~ ^/(site|site-[^/]+)/assets.*/-.+/.* { deny all; }
  # Block access to /wire/config.php, /site/config.php, /site/config-dev.php, and /wire/index.config.php
  location ~ ^/(wire|site|site-[^/]+)/(config|index\.config|config-dev)\.php$ { deny all; }
  # Block access to any PHP-based files in /templates-admin/
  location ~ ^/(wire|site|site-[^/]+)/templates-admin($|/|/.*\.(php|html?|tpl|inc))$ { deny all; }
  # Block access to any PHP or markup files in /site/templates/
  location ~ ^/(site|site-[^/]+)/templates($|/|/.*\.(php|html?|tpl|inc))$ { deny all; }
  # Block access to any PHP files in /site/assets/
  location ~ ^/(site|site-[^/]+)/assets($|/|/.*\.php)$ { deny all; }
  # Block access to any PHP files in core or core module directories
  location ~ ^/wire/(core|modules)/.*\.(php|inc|tpl|module)$ { deny all; }
  # Block access to any PHP files in /site/modules/
  location ~ ^/(site|site-[^/]+)/modules/.*\.(php|inc|tpl|module)$ { deny all; }
  # Block access to any software identifying txt files
  location ~ ^/(COPYRIGHT|INSTALL|README|htaccess)\.(txt|md)$ { deny all; }
  # Block all http access to the default/uninstalled site-default directory
location ~ ^/site-default/ { deny all; }

Thank you for any hunch.

Share this post

Link to post
Share on other sites

In  fact my root page  has a server error and my others are blank.

Share this post

Link to post
Share on other sites

Hi, Sten.

I think you too complicated your config.

try this sections:


location ~ \.php$ {
        include snippets/fastcgi-php.conf;

    location / {
        try_files  $uri  $uri/  /index.php?it=$uri&$args;

I use tcp connection rathe then socket. Because it  more easy.  (in /etc/php/7.x/fpm/pool.d/www.conf needed entry listen = )

Share this post

Link to post
Share on other sites

Thank you Tarkvsg, I  will try. Eventually I reinstalled my PW.


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By anttila
      I have a new server and wanted to use nginx. However, I have two ProcessWire websites which does not let me do anything. I'll get this error every time when I try to change something and sometimes when logging in. Deleted all caches already from ProcessWire and browser. This also happens after installing new ProcessWire and all directories were owned by www-data.
      I also have two working websites without any problems and all these four uses same kind of setting on nginx config. I don't understand why some of those working fine and some not.
      Running Debian 10, MariaDB 10.3.22, PHP 7.4, nginx 1.14.2
      This request was aborted because it appears to be forged. #0 /sites/clients/clientname/wire/modules/Process/ProcessPageTrash.module(49): ProcessWire\SessionCSRF->validate() #1 /sites/clients/clientname/wire/core/Wire.php(380): ProcessWire\ProcessPageTrash->___execute() #2 /sites/clients/clientname/wire/core/WireHooks.php(823): ProcessWire\Wire->_callMethod() #3 /sites/clients/clientname/wire/core/Wire.php(450): ProcessWire\WireHooks->runHooks() #4 /sites/clients/clientname/wire/core/ProcessController.php(337): ProcessWire\Wire->__call() #5 /sites/clients/clientname/wire/core/Wire.php(380): ProcessWire\ProcessController->___execute() #6 /sites/clients/clientname/wire/core/WireHooks.php(823): ProcessWire\Wire->_callMethod() #7 /sites/clients/clientname/wire/core/Wire.php(450): ProcessWire\WireHooks->runHooks() #8 /sites/clients/clientname/wire/core/admin.php(150): ProcessWire\Wire->__call() #9 /sites/clients/clientname/wire/modules/AdminTheme/AdminThemeDefault/controller.php(13): require('/sites/clients/...') #10 /sites/clients/clientname/site/templates/admin.php(15): require('/sites/clients/...') #11 /sites/clients/clientname/wire/core/TemplateFile.php(318): require('/sites/clients/...') #12 /sites/clients/clientname/wire/core/Wire.php(380): ProcessWire\TemplateFile->___render() #13 /sites/clients/clientname/wire/core/WireHooks.php(823): ProcessWire\Wire->_callMethod() #14 /sites/clients/clientname/wire/core/Wire.php(450): ProcessWire\WireHooks->runHooks() #15 /sites/clients/clientname/wire/modules/PageRender.module(536): ProcessWire\Wire->__call() #16 /sites/clients/clientname/wire/core/Wire.php(383): ProcessWire\PageRender->___renderPage() #17 /sites/clients/clientname/wire/core/WireHooks.php(823): ProcessWire\Wire->_callMethod() #18 /sites/clients/clientname/wire/core/Wire.php(450): ProcessWire\WireHooks->runHooks() #19 /sites/clients/clientname/wire/core/WireHooks.php(924): ProcessWire\Wire->__call() #20 /sites/clients/clientname/wire/core/Wire.php(450): ProcessWire\WireHooks->runHooks() #21 /sites/clients/clientname/wire/modules/Process/ProcessPageView.module(213): ProcessWire\Wire->__call() #22 /sites/clients/clientname/wire/core/Wire.php(383): ProcessWire\ProcessPageView->___execute() #23 /sites/clients/clientname/wire/core/WireHooks.php(823): ProcessWire\Wire->_callMethod() #24 /sites/clients/clientname/wire/core/Wire.php(450): ProcessWire\WireHooks->runHooks() #25 /sites/clients/clientname/index.php(55): ProcessWire\Wire->__call() #26 {main}  
    • By Peter Knight
      Hi all
      My .htaccess file is correctly redirecting all requests to
      https:// www. That's great until I want to work locally.
      I thought I had seen a blog post by Ryan where there was a new config setting to ignore both of these if working from localhost?
      I can't find it now so wondering if I was imagining 😕
    • By benbyf
      I always seem to get this warning on every new install of PW on my Ubuntu 14 box with Digital Ocean. The servers are usually based in the UK and I was wondering if I should be adding something other than the below in the config? Is there a UK based locale code? Quick Google didnt come up with much.
      Warning: your server locale is undefined and may cause issues. Please add this to /site/config.php file (adjust “en_US.UTF-8” as needed): setlocale(LC_ALL,'en_US.UTF-8');
      Added to the config file:
    • By rushy
      I'm trying to migrate a PW site on my local dev server to a shared hosted server and have used the ProcessExportProfile module to export a profile as a zip file. So far so good. I then deploy new install of PW on the server by unzipping the PW installation files but I do not run the install until I have replaced the various site profiles with the files from the exported profile. So basically:
      In the PW install files I delete all the site-* folders except site-default. This one I overwrite with  the export profile folders so it contains my assets, install, modules and templates folders together with the exported config.php
      I then run the install in the browser in the normal way and it starts the installation and I can see my website profile in the list and I select it. It proceeds as normal and gets to setting up the database. I provide the db info. as usual and it proceeds as far the info. below and 'hangs' at this point , it never goes on to setup the PW login admin. and complete the install I am left at that screen.  
      If I relaunch the browser at the site it all seems to work! BUT I have no admin login to PW so cannot get into the backend. 
      I have basically followed the Installation, Moving and Troubleshooting guide by Joss Sanglier: http://processwire.com/docs/tutorials/installation-moving-and-troubleshooting/page4
      Any idea where I could check for an error log or some help as I am at a loss as to the problem. 
      Many thanks. Paul
      ProcessWire 3.x Installer
       Test Database and Save Configuration
       Database connection successful to pinpoin1_master
       Saved configuration to ./site/config.php
       Profile Import
       Imported database file: ./wire/core/install.sql
       Imported database file: ./site/install/install.sql
    • By modifiedcontent
      I have one central website, with membership registration and content etc., and then several related websites with their own URL/domains, each on Processwire, all on the same server.
      I would like to access the database of the central website from the sister websites. How would I do that?
      You can't bootstrap one PW installation into another. You can include template parts from one in the other by just using the server path, but whatever you try to get/post just comes/goes to the database of the site you are on.
      Could you switch databases by including the config.php from another PW installation somewhere?
      What is the correct, secure way to do this?
  • Create New...