Error while creating Virtual Host on Nginx


I am currently creating new virtual host on my droplet which is already installed Ghost (blog) via DigitalOcean’s Ghost Application. I tried to set up virtual host using this guide, but it is not working correctly.

My root directory is under var/www . New config for sites-available is as below:

server {
        listen 80; ## listen for ipv4; this line is default and implied
        #listen [::]:80 default ipv6only=on; ## listen for ipv6

        root /var/www/test;
        index index.html index.htm;

        # Make site accessible from http://localhost/

And also added new domain in /etc/hosts file. (let say my ip is

Please let me know if there is something wrong with my doing. And also please tell me what should I do. Thanks

Show comments

Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

so you have to checck whether the apache service is running on your pc then sudo service apache2 stop sudo service nginx restart because in apache we have given the same http address 80 and also in nginx is given address 80 so that it telll like that