Nginx directive snippet shows no effect

Discussion in 'Installation/Configuration' started by fume, Oct 16, 2018.

  1. fume

    fume New Member

    Yesterday I've installed a new server with Nginx based on these instructions. Then I did the installation of Let's Encrypt script. After these steps I created two Nginx directive snippets and added it to the website (I am using https).
    For www.mydomain.com/phpmyadmin
    Code:
            location /phpmyadmin {
                   root /usr/share/;
                   index index.php index.html index.htm;
                   location ~ ^/phpmyadmin/(.+\.php)$ {
                           try_files $uri =404;
                           root /usr/share/;
                           fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
                           fastcgi_param HTTPS on; # <-- add this line
                           fastcgi_index index.php;
                           fastcgi_param SCRIPT_FILENAME $request_filename;
                           include /etc/nginx/fastcgi_params;
                           fastcgi_param PATH_INFO $fastcgi_script_name;
                           fastcgi_buffer_size 128k;
                           fastcgi_buffers 256 4k;
                           fastcgi_busy_buffers_size 256k;
                           fastcgi_temp_file_write_size 256k;
                           fastcgi_intercept_errors on;
                   }
                   location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
                           root /usr/share/;
                   }
            }
            location /phpMyAdmin {
                   rewrite ^/* /phpmyadmin last;
            }
    For www.mydomain.com/webmail
    Code:
            location /roundcube {
                   root /usr/share/;
                   index index.php index.html index.htm;
                   location ~ ^/roundcube/(.+\.php)$ {
                           try_files $uri =404;
                           root /usr/share/;
                           fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
                           fastcgi_param HTTPS on; # <-- add this line
                           fastcgi_index index.php;
                           fastcgi_param SCRIPT_FILENAME $request_filename;
                           include /etc/nginx/fastcgi_params;
                           fastcgi_param PATH_INFO $fastcgi_script_name;
                           fastcgi_buffer_size 128k;
                           fastcgi_buffers 256 4k;
                           fastcgi_busy_buffers_size 256k;
                           fastcgi_temp_file_write_size 256k;
                           fastcgi_intercept_errors on;
                   }
                   location ~* ^/roundcube/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
                           root /usr/share/;
                   }
            }
            location /webmail {
                   rewrite ^/* /roundcube last;
            }
    When I will visit the links www.mydomain.com/phpmyadmin or www.mydomain.com/webmail I get an 404 error. It seems that the snippet has no effect. Has anyone an idea?

    Ubuntu 18.04 LTS and ISPConfig 3.1
     
    Last edited: Oct 16, 2018
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Do you have any other nginx directives in that site which might override the snippet? Is there a vhost file with .err file extension for that site in /etc/nginx/sites-available/ folder?
     
  3. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Try disabling this line: # fastcgi_param HTTPS on; # <-- add this line
     
  4. fume

    fume New Member

    In my opinion no. I have only snippets for phpmyadmin, webmail and gzip. Yes, there is a .err file. It's curious because this file contains the snippets. :confused:
    I did it but without positive result.
     
  5. fume

    fume New Member

    I am surprised, it works. I think it was the missing ";" at the end of the gzip snippet.
    Thank you for helping!
     
  6. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Please don't mind me asking you get that working by fixing ; at the end of gzip snippet - is it without fastcgi_param HTTPS on; disabled?
     
  7. fume

    fume New Member

    It's disabled.
     
    ahrasis likes this.

Share This Page