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
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
I configured it with server blocks. My website is stored under /var/www/woltlab/html/ and worked without SSL. With SSL this is no longer possible, even if I uninstall SSL. For example, the other websites and services later run on forum.example.com and /var/www/forum/html.
The site exist under /var/www/woltlab/html and i created the info.php there too.
needed set same website root path at ssl host and http host in this file. Then put the page in the corresponding directory.
e.g: i have one website in /var/www/web1, so i need set sites-availble config file “root” line is /var/www/web1 (include redirct host)
after that can create index.html test is working status.
nginx default home page types is index.html index.php index.htm if need change, can add a this line.
index index.html index.php index.htm; #input you want to settings index page file name
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.