Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've just setup a VPS running Ubuntu server 10.10 as a test environment to run with nginx. This far i've ran apt-get install nginx php5 php5-cgi and accessed the IP of the VPS with a browser which outputs It works, so it should be ready to run. Never having worked with nginx in the past, I have no idea on what to do next.

How should I config my nginx install to run properly as a staging server in my LAN?
Apparently, there's multiple configs for nginx including sites-default and nginx-default making me really confused.

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

The exceptional Linode Library has an article on how to install a LEMP stack on Ubuntu 10.10: http://library.linode.com/lemp-guides/ubuntu-10.10-maverick/

share|improve this answer
add comment

nginx works very similarly to how Apache works on Debian systems. There are two folders inside of /etc/nginix

/etc/nginx

The two folders are sites-enabled and sites-available. The way you make it work is to write a Virtual host config

inside of sites-available, then make a symbolic link using ln -s to sites-enabled, once this is done you can restart nginix and that virutal host config will be loaded. The server will only read configs that are in sites-enabled. You can use this for hosting multiple different virtual hosts however if you just want to run a single website leave the default virtual host enabled and work with that.

The default config should look something like:

server {
    listen   80 default;
    server_name  localhost;

    access_log  /var/log/nginx/localhost.access.log;

    location / {
            root   /var/www/nginx-default;
            index  index.html index.htm;
    }

Which will be in a file called /etc/nginx/sites-available/default.

All that config is doing is telling nginix to listen on port 80, write to the access log defined there.Its document root is in /var/www/nginx-default.

Lets say you put some html file in /var/www/nginx-default/foo.html, you would be able to access that file through going to your yourip/foo.html

Here is a good guide on how to setup nginx with PHP

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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