Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

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!
Good article - just one nit-picky thing:
sudo service nginx restart is perfectly valid, but if you have a busy site, you might drop a couple of connections.
Safer, cleaner (and easier!) is to follow this tip I’ve been using since I found it on stackoverflow, which comes in very useful if you’re making lots of changes or experimenting and tweaking:
alias n='/etc/init.d/nginx configtest && sudo /etc/init.d/nginx reload'
from then on, just hit n and enter. Instance new config, tested and reloaded if it’s valid.
If you like the alias, just
sudo nano ~/.bash_aliases
add that alias line following the correct format and then
source ~/.bash_aliases
so you won’t need to reload the shell.
(I won’t delve into the whole /var/www vs /usr/share/nginx/html debate because I’m still not decided which is correct! )
Hey, this worked perfectly with my first two test domains, but for some reason once I moved my actual domain in it’s pointing to one of the test domains rather than to its own folder even though I followed the exact same steps. Any idea why?
Thanks!
@jcalifa: Could you post your Nginx configurations on a pastebin? That would make it much easier to help you.
And how i redirect www.domain.com to domain.com in this config file of a domains?
@gugaalves: Add a new virtualhost with the following config:
server {
listen 80;
server_name www.domain.com;
return 301 http://domain.com$request_uri;
}
and restart nginx.
I found that the line
server_names_hash_bucket_size: 64;
Caused and ‘unknown directive’ error when starting nginx and has to remove the colon for it to work:
server_names_hash_bucket_size 64;
Also, this line did not exist to be un-commented as descrived above, so you add it inside the http area:
http {
server_names_hash_bucket_size 64;
...
}