Hello everyone, I can't figure out why if I insert the Nginx directives from the ISPConfig3 control panel, they don't work. If I modify the domain.com.vhost file, they work perfectly (until they are overwritten). I haven't found the answer in the manual. Could someone help me?
It would be helpful when you show what directives you try to set and explain exactly where you set them.
And see chapter 5 in read before posting: https://forum.howtoforge.com/threads/please-read-before-posting.58408/
domain > options > nginx Directives: server { listen *:80; listen [::]:80; listen *:443 ssl http2; listen [::]:443 ssl http2; server_name domain.com www.domain.com; root /var/www/domain.com/web/domain/web; ssl_certificate /var/www/clients/client2/web1/ssl/domain.com-le.crt; ssl_certificate_key /var/www/clients/client2/web1/ssl/domain.com-le.key; ssl_protocols TLSv1.3 TLSv1.2; if ($scheme != "https") { return 301 https://$host$request_uri; } if ($host = "domain.com") { return 301 https://domain.com$request_uri; } index index.php index.html index.htm; error_page 404 /index.php; error_log /var/log/ispconfig/httpd/domain.com/error.log; access_log /var/log/ispconfig/httpd/domain.com/access.log combined; location / { try_files $uri /index.php?$query_string; } location ~ ^/(index|update)\.php(/|$) { include fastcgi_params; fastcgi_pass unix:/run/php/php8.3-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_split_path_info ^(.+\.php)(/.*)$; fastcgi_intercept_errors on; } location ~ \.php$ { include fastcgi_params; fastcgi_pass unix:/run/php/php8.3-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_index index.php; fastcgi_split_path_info ^(.+\.php)(/.*)$; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_intercept_errors on; } # Protezione per .well-known location ^~ /.well-known/acme-challenge/ { root /usr/local/ispconfig/interface/acme/; access_log off; log_not_found off; auth_basic off; autoindex off; } location /phpmyadmin { root /usr/share/; index index.php; location ~ ^/phpmyadmin/(.+\.php)$ { include fastcgi_params; fastcgi_pass unix:/run/php/php8.3-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; } location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { root /usr/share/; } } location = /error/400.html { internal; } location = /error/401.html { internal; } location = /error/403.html { internal; } location = /error/404.html { internal; } location = /error/405.html { internal; } location = /error/500.html { internal; } location = /error/502.html { internal; } location = /error/503.html { internal; } }
Code: [QUOTE="till, post: 463220, member: 3"]And see chapter 5 in read before posting: https://forum.howtoforge.com/threads/please-read-before-posting.58408/[/QUOTE] ##### SERVER ##### IP-address (as per hostname): ***.***.***.*** [WARN] could not determine server's ip address by ifconfig [INFO] OS version is Debian GNU/Linux 12 (bookworm) [INFO] uptime: 16:07:14 up 1 day, 18:44, 1 user, load average: 0.00, 0.00, 0.00 [INFO] memory: total used free shared buff/cache available Mem: 3.7Gi 2.4Gi 517Mi 106Mi 1.2Gi 1.3Gi Swap: 0B 0B 0B [INFO] systemd failed services status: UNIT LOAD ACTIVE SUB DESCRIPTION 0 loaded units listed. [INFO] ISPConfig is installed. [WARN] /usr/local/ispconfig/server/lib/config.inc.php is missing. ##### VERSION CHECK ##### [INFO] php (cli) version is 8.3.15 [INFO] php-cgi (used for cgi php in default vhost!) is version 8.2.27 ##### PORT CHECK ##### [WARN] Port 143 (IMAP server) seems NOT to be listening [WARN] Port 993 (IMAP server SSL) seems NOT to be listening [WARN] Port 110 (POP3 server) seems NOT to be listening [WARN] Port 995 (POP3 server SSL) seems NOT to be listening [WARN] Port 465 (SMTP server SSL) seems NOT to be listening ##### MAIL SERVER CHECK ##### [WARN] I found no "submission" entry in your postfix master.cf [INFO] this is not critical, but if you want to offer port 587 for smtp connections you have to enable this. [WARN] I found no "smtps" entry in your postfix master.cf [INFO] this is not critical, but if you want to offer SSL for smtp (not TLS) connections you have to enable this. ##### RUNNING SERVER PROCESSES ##### [WARN] I could not determine which web server is running. [WARN] I could not determine which mail server is running. [WARN] I could not determine which pop3 server is running. [WARN] I could not determine which imap server is running. [WARN] I could not determine which ftp server is running. ##### LISTENING PORTS ##### (only () Local (Address) [anywhere]:443 (-) [anywhere]:21 (-) [anywhere]:22 (-) [anywhere]:80 (-) [localhost]:53 (-) [localhost]:53 (-) [localhost]:53 (-) [localhost]:53 (-) [localhost]:25 (-) ***.***.***.***:53 (-) ***.***.***.***:53 (-) ***.***.***.***:53 (-) ***.***.***.***:53 (-) [anywhere]:8081 (-) [anywhere]:8080 (-) [localhost]:953 (-) [localhost]:953 (-) [localhost]:953 (-) [localhost]:953 (-) [anywhere]:3306 (-) [localhost]:11211 (-) *:*:*:*::*:953 (-) *:*:*:*::*:953 (-) *:*:*:*::*:953 (-) *:*:*:*::*:953 (-) *:*:*:*::*:443 (-) *:*:*:*::*:21 (-) *:*:*:*::*:22 (-) *:*:*:*::*f816:3eff:fe45:53 (-) *:*:*:*::*f816:3eff:fe45:53 (-) *:*:*:*::*f816:3eff:fe45:53 (-) *:*:*:*::*f816:3eff:fe45:53 (-) *:*:*:*::*:80 (-) *:*:*:*::*:53 (-) *:*:*:*::*:53 (-) *:*:*:*::*:53 (-) *:*:*:*::*:53 (-) *:*:*:*::*:25 (-) *:*:*:*::*:8081 (-) *:*:*:*::*:8080 (-) *:*:*:*::*:3306 (-) ##### IPTABLES ##### ##### LET'S ENCRYPT #####
Post #4: You posted a complete vhost file and not the directives you set, and you did not mention where you set them. So the info you posted does not help here. Post #5: I asked you to follow Chapter 5, and you posted info from Chapter 1. If you want help, please post what was requested in post #2 and post #3.
And in case you really put the complete vhost file from #4 into the nginx directives field, this can not work as you can not nest a vhost into another vhost plus it would not make sense to do so anyway. You must put only the directives that shall get added into that field, which in your case is probably just: Code: location / { try_files $uri /index.php?$query_string; }
Sorry, I'm not as experienced as you might have noticed, but in my case, I configured (Websites > Web domain > Options > nginx Directives) the root with Code: ##subroot drupal/web ## and added the directive: Code: location / { try_files $uri /index.php?$query_string; } However, it doesn't work and returns a 500 error. I've checked that the root path is correct and that the index.php file is in the right directory, but the problem persists.. In short, I would like to make a Drupal site work in the root drupal/web
The reason is that Composer installs Drupal within a directory that also contains Drush, the composer.json file, and other related files. For better organization, I prefer to have the /web folder located at /var/www/domain.com/web/drupal/web. The issue only arises with Nginx because with Apache, it's straightforward to define the root using: DocumentRoot /var/www/domain.com/web/drupal/web in websites > web domain > options > directives and everything works perfectly. Is it really that difficult to achieve an equivalent setup with Nginx?"
Thank you for the help: 2025/01/16 09:20:51 [error] 644487#644487: *3 "/var/www/domain.com/web/domain/web/index.html" is forbidden (13: Permission denied), client: 37.161.234.171, server: domain.com, request: "GET / HTTP/2.0", host: "domain.com" 2025/01/16 09:20:51 [error] 644487#644487: *3 open() "/var/www/domain.com/web/domain/web/error/403.html" failed (13: Permission denied), client: 37.161.234.171, server: domain.com, request: "GET / HTTP/2.0", host: "domain.com" 2025/01/16 09:20:51 [error] 644487#644487: *3 open() "/var/www/domain.com/web/domain/web/error/403.html" failed (13: Permission denied), client: 37.161.234.171, server: domain.com, request: "GET / HTTP/2.0", host: "domain.com" 2025/01/16 09:20:51 [error] 644487#644487: *3 open() "/var/www/domain.com/web/domain/web/error/403.html" failed (13: Permission denied), client: 37.161.234.171, server: domain.com, request: "GET / HTTP/2.0", host: "domain.com" 2025/01/16 09:20:51 [error] 644487#644487: *3 open() "/var/www/domain.com/web/domain/web/error/403.html" failed (13: Permission denied), client: 37.161.234.171, server: domain.com, request: "GET / HTTP/2.0", host: "domain.com" 2025/01/16 09:20:51 [error] 644487#644487: *3 open() "/var/www/domain.com/web/domain/web/error/403.html" failed (13: Permission denied), client: 37.161.234.171, server: domain.com, request: "GET / HTTP/2.0", host: "domain.com" 2025/01/16 09:20:51 [error] 644487#644487: *3 open() "/var/www/domain.com/web/domain/web/error/403.html" failed (13: Permission denied), client: 37.161.234.171, server: domain.com, request: "GET / HTTP/2.0", host: "domain.com" 2025/01/16 09:20:51 [error] 644487#644487: *3 open() "/var/www/domain.com/web/domain/web/error/403.html" failed (13: Permission denied), client: 37.161.234.171, server: domain.com, request: "GET / HTTP/2.0", host: "domain.com" 2025/01/16 09:20:51 [error] 644487#644487: *3 open() "/var/www/domain.com/web/domain/web/error/403.html" failed (13: Permission denied), client: 37.161.234.171, server: domain.com, request: "GET / HTTP/2.0", host: "domain.com" 2025/01/16 09:20:51 [error] 644487#644487: *3 open() "/var/www/domain.com/web/domain/web/error/403.html" failed (13: Permission denied), client: 37.161.234.171, server: domain.com, request: "GET / HTTP/2.0", host: "domain.com" 2025/01/16 09:20:51 [error] 644487#644487: *3 rewrite or internal redirection cycle while internally redirecting to "/error/403.html", client: 37.161.234.171, server: domain.com, request: "GET / HTTP/2.0", host: "domain.com" Nginx directives (websites > web domain > options > directives): ##subroot drupal/web ## location / { try_files $uri /index.php?$query_string; } location ~ ^/(index|update)\.php(/|$) { include fastcgi_params; fastcgi_pass {FASTCGIPASS}; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_split_path_info ^(.+\.php)(/.*)$; fastcgi_intercept_errors on; }
First, I receommend you remove the PHP location, its not needed and might cause the website to fail. Then, you configured the website to use custom error pages, which means you either must provide them in the correct new location: /var/www/domain.com/web/domain/web/error/403.html or switch them off in website settings. I would recommend you switch them off in the website settings. Then, you should check if all the files and folders you created in the custom document root are owned by the web user and client group of that website.