Welcome! Log In Create A New Profile

Advanced

Changin nginx document root directory

Posted by ryanjan18 
Changin nginx document root directory
October 18, 2012 05:45AM
Hi everyone! So I'm new to nginx and want to change my document root directory from "root /usr/share/nginx/html" to "home/user101/box/developments" . How do I do it? Thanks!
Re: Changin nginx document root directory
October 19, 2012 03:07AM
Change the document root directive, in nginx.conf or your_site.conf, both of these files are available in the directory where you installed nginx (/etc/nginx in my case) The document root directive may be inserted under the server block as. You can define it thus
root /usr/share/nginx/www;
Re: Changin nginx document root directory
October 19, 2012 03:19AM
I found this line
root /usr/share/nginx/html;
from
/etc/nginx/sites-available/default
I think that's right? I changed the path to /home/user101/box/development
I am receiving forbidden and "No files specified"
How can I fix it? What is the right permission I need on the folders/files?
Also I've seen this line at nginx.conf -> user www-data;
--
Thanks for replying!
Re: Changin nginx document root directory
October 19, 2012 04:01AM
Also change the root directive in /etc/nginx/sites-enabled/ whichever conf file is here.
Make sure you pass the index directive too, so that nginx knows what is the index file for the root directory. You can pass it thus
index index.htm index.php;

This should be enough to make your setup work :)
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 237
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