1

I am running Nginx on an Ubuntu 14.04.5 server. I am trying to set up a new server block but when I navigate to the URL I see this error:

Nginx server block error

My configuration for this virtual host is below.

The directory that I'd like my subdomain to point to is /var/www/vhosts/ny-video.splashpreviews.com

In /etc/nginx/sites-available is my server block file. The server configuration part of that file is below:

server {
listen *:80;
listen [::]:80;

root /var/www/vhosts/ny-video.splashpreviews.com;
index index.php index.html index.htm;

# Make site accessible from http://localhost/
server_name ny-video.splashpreviews.com;
}

I then enabled the server block and restarted Nginx. Is there something I am missing in the process or something I am doing wrong that is causing this to not work? Any guidance would be appreciated. Thank you.

2
  • 1
    Have you added the DNS entry for the hostname? It seems that you haven't. Commented Mar 8, 2017 at 2:50
  • Thank you. I added the DNS entry and now it displays a "Web Server's Default Page", so its still not working. What am I missing in my setup? Commented Mar 8, 2017 at 18:27

1 Answer 1

1

You need to add splashpreviews.com site to configuration and allow locations of the server. There can be several location sections, limiting access to each subdirectory.

http {
  limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;
  include     /etc/nginx/mime.types;
  ....
  server {
    listen 80;
    server_name splashpreviews.com www.splashpreviews.com;
    location / {
      allow all;
    }
    ....
  }
  server {
    listen 80;
    server_name ny-video.sp.com;
    location / {
      allow all;
    }
Sign up to request clarification or add additional context in comments.

4 Comments

I tried adding this to my configuration but my domain is still displaying a "Web Server's Default Page" ny-video.splashpreviews.com. Am I missing something important in my setup?
Yes. Add ny-viedo ... to list of domains in server_name
Now I am seeing this message: Welcome to nginx! If you see this page, the nginx web server is successfully installed and working. Further configuration is required. For online documentation and support please refer to nginx.org. Commercial support is available at nginx.com. Thank you for using nginx.
Congrats! Now set document_root or proxy to apache - only 1-2 steps to go

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.