0

I've just recently swapped over to nginx from apache2, and it seems to be handling load times much better. However, I've now lost access to my forum subdomain. Whenever I goto my forum's subdomain, it just redirects me to my site's root directory. I've enabled the site and made the link to the sites-available directory. Here's my current server block:

  server {
    listen 80;
    server_name forum.project-freedom.net;
    root /var/www/forum;

    index index.html index.htm index.php;

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

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php8.0-fpm.sock;
    }
 }

My main websites directory is /var/www/html/

Upon checking my nginx error log, I've seen I got this error:

2023/04/16 05:26:20 [error] 45598#45598: *65 open() "/var/www/html/service_worker.js" failed (2: No such file or directory), client: 172.70.34.128, server: _, request: "GET /service_worker.js HTTP/2.0", host: "forum.project-freedom.net">
2023/04/16 05:35:07 [error] 45598#45598: *257 open() "/var/www/html/service_worker.js" failed (2: No such file or directory), client: 172.70.135.196, server: _, request: "GET /service_worker.js HTTP/2.0", host: "forum.project-freedom.ne>
2023/04/16 05:35:37 [error] 45598#45598: *258 "/var/www/html/project-freedom.net/index.php" is not found (2: No such file or directory), client: 162.158.78.139, server: _, request: "GET /project-freedom.net/ HTTP/2.0", host: "project-fr>
2023/04/16 05:42:20 [error] 45598#45598: *416 open() "/var/www/html/service_worker.js" failed (2: No such file or directory), client: 172.70.38.15, server: _, request: "GET /service_worker.js HTTP/2.0", host: "forum.project-freedom.net">
2023/04/16 05:42:32 [notice] 46586#46586: signal process started
<dom.net", referrer: "https://forum.project-freedom.net/service_worker.js"
3
  • 1
    Nginx is not using that server block. It's using the one with the server_name _; statement (see the error log in your question). Use nginx -T (uppercase T) to view the entire configuration across all included files and ensure that the server block for forum.project-freedom.net appears. Apr 16 at 9:05
  • I'm getting this reply when I do nginx -T: nginx: [emerg] the size 52428800 of shared memory zone "SSL" conflicts with already declared size 10485760 in /etc/nginx/sites-enabled/project-freedom.net:23 nginx: configuration file /etc/nginx/nginx.conf test failed Apr 16 at 16:18
  • 1
    Nginx will not restart until you fix that fatal error. Without seeing the full output of nginx -T it is difficult to say where the error is. Edit your question and add further details. Apr 17 at 9:22

0

You must log in to answer this question.

Browse other questions tagged .