Question
404 Not Found Error Nginx Ubuntu 18.10
Hello,
I’m using ubuntu 18.10 and configured Nginx on it. I tried to install Lets Encrypt , but when I tried to access my site, I got 404 error. I created a info.php and tried to open it with www.example.com/info.php and it doesnt work too.
Here is my default site-available config file:
server {
listen "MyServerIP":443 ssl http2;
listen [::]:443 ssl http2;
server_name www."mydomain".de;
set $base /var/www/woltlab/html;
root $base/public;
# SSL
ssl_certificate /etc/letsencrypt/live/mydomain.de/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/mydomain.de/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/mydomain.de/chain.pem;
# logging
access_log /var/log/nginx/mydomain.de.access.log;
error_log /var/log/nginx/mydomain.de.error.log notice;
# index.php
index index.php;
# index.php fallback
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# handle .php
location ~ \.php$ {
include nginxconfig.io/php_fastcgi.conf;
}
include nginxconfig.io/general.conf;
}
# non-www, subdomains redirect
server {
listen "MyServerIP":443 ssl http2;
listen [::]:443 ssl http2;
server_name .mydomain.de;
# SSL
ssl_certificate /etc/letsencrypt/live/mydomain.de/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/mydomain.de/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/mydomain.de/chain.pem;
return 301 https://www.mydomain.de$request_uri;
}
# HTTP redirect
server {
listen "MyServerIP":80;
listen [::]:80;
server_name .mydomain.de;
include nginxconfig.io/letsencrypt.conf;
location / {
return 301 https://www.mydomain.de$request_uri;
}
}
The Config file i created on nginxconfig.io.
The error.log is empty.
I´m new with Nginx and try to configure my own homepage.
I hope you can help me.
Thank you
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×
Double check that your site is in /var/www/html? When I first set up 18.06 it moved my site to var/www/html.old for some reason