Nginx welcome to nginx displays www. prefix; works fine without
Remove one of the server_name s.
Remember to nginx -s reload
. The rest of your code seams fine.
Did you use certbot --nginx
to get ssl for example.com
or www.example.com
?
Because I see both of them here.
If you still have the same issue, I suggest you remove the file, and also the shortcut, and start over. Once you make sure both example.com
or www.example.com
work correctly, then go after issuing the ssl.
And remember, you just need to get ssl for either example.com
or www.example.com
.
Nginx page displaying instead of home page (Digital Ocean - LEMP)
Simplify
Create a "Hello world" index.html and copy it into your project's root directory*.
Divide and conquer
My suggestion to you is to strip your nginx.conf down to a very simple form, like the one below.
server {
listen 80 default;
server_name yourdomainname.com;
root /home/your_app_name/public;
try_files $uri/index.html $uri ;
error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}
Organization
*I would recommend you not have your index.html in an nginx directory. Use as your root directory something that is specific to your project, like in the example above. Place your Hello World index page there.
Restart
Now reload NGINX and see if it is loading your simple "Hello World" index.html. If so, start to add complexity, one component at a time.
File permissions
The #1 gotcha on unix based OS is the file permissions. It's important to look at your NGINX error logs to see if you're getting pinged by user/group blocks on files and dirs. If NGINX does not have permission to read index.html, game over.
Digital Ocean calls their tools "one-click installs" and this is misleading. I have several DO VPSs setup, so I know that their installs are not by any means complete installs, as you'd expect. Going back to installing components one at a time and confirming each is working is the best method.
Nginx only shows welcome page
Missing includes in nginx.conf
include /usr/local/etc/nginx/sites-enabled/*;
http://wiki.nginx.org/CoreModule#include
Nginx: Welcome to nginx! page keeps showing
Holy ish. All that is apparently required to make it work is:
Comment out/delete the "location /" directive which is added by default during the installation:
# location / {
# root html;
# index index.html index.htm;
# passenger_enabled on;
# }
(If anybody knows why, I'd be interested to know.)
Welcome to nginx! page keeps on showing
I might be a little late but I had the same issue and solved it by doing the following in my nginx site configuration file:
server {
listen 80;
server_name example.com;
return 301 https://$server_name$request_uri;
}
Related Topics
How to Install a Gem or Update Rubygems If It Fails With a Permissions Error
Why Use Ruby'S Attr_Accessor, Attr_Reader and Attr_Writer
How to Make --No-Ri --No-Rdoc the Default For Gem Install
Why Doesn't Ruby Support Method Overloading
How to Split (Chunk) a Ruby Array into Parts of X Elements
How to Find an Item in Array Which Has the Most Occurrences
Group Hashes by Keys and Sum the Values
Access Variables Programmatically by Name in Ruby
Regex to Split Bbcode into Pieces
Accessing Elements of Nested Hashes in Ruby
How to Reload the Current Page in Ruby on Rails
How to Write a Switch Statement in Ruby
How to Get a Random Number in Ruby
No Such File to Load - Rubygems (Loaderror)
Submit Post Data from Controller to Another Website in Rails
Using Net::Http.Get For an Https Url
Cannot Load Such File - Script/Rails: Getting This Error While Remote Debugging Through Rubymine