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!
You would update the server_name entry to use your subdomain instead of your regular domain.com.
I’ve setup several server blocks this way (although, I put them all in one file instead of having separate files per domain). However, in a web browser, I can browse to http://<my ip>/domain.com/public_html. Is there any way to make it so this is not possible and only http://domain.com works? Or maybe I did something wrong? I tried playing around with permissions - I set /var/www to 700 and /var/www/doman.com/public_html to 755 but that didn’t work - I got 403 errors for http://domain.com.
That’s supposed to be http://{my ip}/domain.com/public_html that I can browse to and don’t want to.
OK, I think I found a solution. I had a server block entry (the default one) that mapped my ip address to /var/www. I removed this entry and now I can’t browse to http://{my ip}/domain.com/public_html. It rewrites the ip address part to the domain.com in the next server block in the file (which I guess has now become the default). So, typing in http://{my ip}/domain.com/public_html rewrites itself to http://domain.com/domain.com/public_html, which produces a 403 error (which I’m ok with, unless someone knows of a more graceful way to handle this - can’t really think of what it should do with a url like that, other than error out, tho).
Can anyone out there confirm that this sounds like a correct/acceptable solution?
There is no need to separate your different domains into separate files if you do not want to.
Each domain that you configure should have its own block: server { }
The root directive specifies which directory you would like to serve files for: root /var/www/example.com/public_html;
If you point it to public_html/ there is no need to add a domain.com/public_html when browsing your website.
server_name domain.com server_name host.domain.com
Are the directives to nginx which specify which domains this server { } block will be active for.
You can also remove the global root directive and test with just the “server” definitions and then ensure that your server blocks have server_name set and a listen directive to specify which IPs and ports that domain should be active on the server for.
If you are still having issues might be a good idea to paste in the specific server block definition which isn’t working and we can review that.
Delete the default nginx server block to avoid “conflicting server name” error
sudo rm /etc/nginx/sites-enabled/default
Hi,
I’ve followed this tutorial and it worked for me. But now, accessing example.com/phpmyadmin or 123.45.678.910/phpmyadmin returns a 500 Internal Server Error.
What do I need to do to get phpMyAdmin back up and running?
Scratch that, I wasn’t adding /public_html at the end of the path for my site’s root when creating the symbolic link for phpMyAdmin.
So, if anyone moved their site root as above, to /var/www/example/com/public_html , you obviously need to do this for phpMyAdmin :
sudo ln -s /usr/share/phpmyadmin/ /var/www/example.com/public_html
My question is: is there any way to create a sym link for phpMyAdmin, so that I can access it from any domain I add to my VPS? i.e. access it from example.com/phpmyadmin, example2.com/phpmyadmin and so on.