Welcome! Log In Create A New Profile

Advanced

New member - Start HTML editing Find directory

Posted by gordonisnz 
New member - Start HTML editing Find directory
August 22, 2010 12:06AM
Hello.

I'm new to NGINX (but have used other servers before...)

Basically, I've been working on a live nginx server, but want to install nginx on my home PC - In the same format / layout as the live server.

I have Linux - Ubuntu. & have let the system automatically install nginx.

:- I've installed nginx

:- when I go to http://localhost/ - It shows the "Welcome to nginx!" message :)

Queries

1):- How do I find out what directory (on my ubuntu PC) has the hTML files that show the welcome message (So I know where to edit it..)

2) which directory on my PC has the nginx config files (So I can edit the base directory that shows my PHP/HTML files etc..)

I'm wanting to edit - or create a /home/sites/nameofsite/(HTML & PHP Files go here etc...) and have http://nameofsite.localhost/

PS the /home/sites/ directory already exists
Re: New member - Start HTML editing Find directory
August 22, 2010 01:19AM
OK, I've found the directory to edit the nginx html files & have created a subdirectory.localhost (the subdirectory points to my main welcome message (again)...)

HOWEVER :- If I try adding / changing virtual hosts - I get errors

website says host not found (for subdomain & main localhost)..

the error log for nginx says :-


[quote]
2010/08/19 22:07:31 [emerg] 2223#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2010/08/19 22:07:31 [emerg] 2223#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2010/08/19 22:07:31 [emerg] 2223#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2010/08/19 22:07:31 [emerg] 2223#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2010/08/19 22:07:31 [emerg] 2223#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
[/quote]

Now - according to what I've figured out - Is both sites subdomain.localhost/ localhost/ are both listening on port 80 which is causing an error.


the virtual hosts tutorials don't explain anything much, & just has a 'working example' (which doesn't work.)

it doesn't explain *WHY* it is supposed to work - so I can figure out what I'm doing wrong.

is there a step-by-step guide to virtual hosts ?? and to explain line-by-line what each part does

& do we have a different port name for each subdomain ?
Re: New member - Start HTML editing Find directory
August 22, 2010 01:27AM
Another error - when I restart the server

[quote]
gordon@gordon-desktop:~$ sudo /etc/init.d/nginx restart
Restarting nginx: [error]: the duplicate default server in /etc/nginx/sites-enabled/default:23
configuration file /etc/nginx/nginx.conf test failed
gordon@gordon-desktop:~$

[/quote]

heres my sites-enabled/default - i have marked line 23

(Ive replaced my domain directory with SUB / SUBDIRECTORY )

[quote]

server {
listen 80 default;
server_name SUB.localhost;

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

location / {
root /home/gordon/SUBDIRECYORY/;
index index.php index.htm index.html;
}
}


server {
listen 80 default; <<<< LINE 23
server_name localhost;


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

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

location /doc {
root /usr/share;
autoindex on;
allow 127.0.0.1;
deny all;
}

location /images {
root /usr/share;
autoindex on;
}

}
[/quote]
Re: New member - Start HTML editing Find directory
August 22, 2010 04:01AM
Never mind - Fixed :)

I had "default" on both 'listen' lines. I guess only 1 default is good :)


all fixed
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 300
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready