Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Running Ubuntu 13.10 in VirtualBox.

I've put my website in this folder:

And created the log folder on /srv/www/

I've done these steps:

sudo apt-get install nginx
sudo chown -R www-data:www-data /srv/www/
sudo chmod 755 /srv/www

The config files looks like this:


server {
  listen 80;

  access_log /srv/www/;
  error_log /srv/www/;

  location / {
      root /srv/www/;
      index index.html;


user www-data;
worker_processes 4;
pid /run/;

events {
  worker_connections 768;

http {
  sendfile on;
  tcp_nopush on;
  tcp_nodelay on;
  keepalive_timeout 65;
  types_hash_max_size 2048;

  include /etc/nginx/mime.types;
  default_type application/octet-stream;

  access_log /var/log/nginx/access.log;
  error_log /var/log/nginx/error.log;

  gzip on;
  gzip_disable "msie6";

  include /etc/nginx/conf.d/*.conf;
  include /etc/nginx/sites-enabled/;

I've enabled the file with:

sudo ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled/

Editted /etc/hosts, but with real ip instead of x:       localhost       lalle-VM


sudo service nginx restart

* Restarting nginx nginx                                                [ OK ]

Result, localhost work too:

No errors in /var/log/nginx/error.log

Anybody have any ideas what I'm doing wrong? I want to be able to access my nginx server remotely on my public IP. Thanks.

share|improve this question

closed as off-topic by Michael Hampton Feb 28 '14 at 17:44

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must be relevant to professional system administration. Server Fault is dedicated to professional system and network administrators. End user and enthusiast questions are off-topic (contact your system administrator or hire a professional to help you out). Please see the Help Center for more information." – Michael Hampton
If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers 2

You need to edit your /etc/hosts file as follows. localhost

but this way you won't get reach real because it's hosted on (unless this is your ip address)

share|improve this answer
Nope that's not my ip, is just a label I have, I could have used or so instead. How can I access my site remotely? I wish to type my real ip (217.72.x.x) into the address bar and load the website. My router have forwarded ports 80 – user2010496 Feb 27 '14 at 17:20
Your remote computer has to solve your domain/label as your server's public IP address. and of course you have to use NAT if your server is behind any router. – risyasin Feb 28 '14 at 19:10
up vote -1 down vote accepted

Solved by opening port 80 in router.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.