0

I'm currently working on Ubuntu 18.04 server and trying to get my vhosts with nginx to work.

Seems like my nginx server block is not properly working, but I'm not sure what im doing wrong. I'm trying to host 3 domains:

clan.mydomain.de blog.mydomain.de webmail.mydomain.de

Ive also installed Iredmail, which edited the default file under sites-available like this:

server {
        listen 80;
        listen [::]:80;

        root /var/www/html;
        index index.html index.htm index.nginx-debian.html;

        server_name webmail.addictedtogames.de.com www.webmail.addictedtogames.de;

        location / {
                try_files $uri $uri/ =404;
        }
}

then i created 2 new files called: clan.addictedtogames.de and blog.addictedtogames.de

clan.addictedtogames.de nginx server block:

server {
        listen 80;
        listen [::]:80;

    root /var/www/clan.addictedtogames.de/html;
    index index.php index.html index.htm index.nginx-debian.html;


    server_name clan.addictedtogames.de www.clan.addictedtogames.de;

    location / {
            try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
            try_files $uri /index.php =404;
            fastcgi_pass 127.0.0.1:9999;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
    }
}

It works all like a charm, except that when I visit clan.addictedtogames.de , it'll download a file.

I would appreciate it, if you can help me. If you need any more informations, feel free to ask :)

Kind Regards,

Yeriwen

Yeriwen
  • 21
  • 3
  • Have you cleared the browser's cache? – Richard Smith Nov 02 '19 at 08:11
  • Yes, I did. I can see a nginx default page, but thats the wrong one. Somehow clan.addictedtogames.de refers also to /var/www/html instead of /var/www/clan.addictedtogames.de/html – Yeriwen Nov 02 '19 at 14:14
  • Use `nginx -T` (uppercase `T`) to view the entire Nginx configuration across all files. Check that your `listen` and `server_name` directives are correct. No missing `;`s. – Richard Smith Nov 02 '19 at 14:30
  • Thanks for your help, so far. I cleared my browser cache again and included " fastcgi_split_path_info ^(.+\.php)(/.+)$;". Now my website is working, but it seems that my nginx isnt rendering css i guess? If you take a look now at clan.addictedtogames.de it'll show you my clean installed wordpress page in plain text without graphics. – Yeriwen Nov 02 '19 at 15:10
  • There is a content-security-policy header that specifies `https`. The browser is refusing to load resource files over `http`. – Richard Smith Nov 02 '19 at 15:44
  • Ahh :) Thanks for clearing this up! I have now installed an ssl certificate via letsencrypt and all is working now like a charm. Thanks a lot Richard! – Yeriwen Nov 02 '19 at 16:00

0 Answers0