fideloper/Vaprobash

Nginx putting its default index.html into the synced folder root?

groovenectar opened this issue · 3 comments

Upon provisioning, Nginx is putting its "Welcome to nginx on Debian!" default index.html file in the root of the synced folder, instead of the document/public root. I can't figure out why.

Since I can't use NFS, my synced folder config looks like this:

config.vm.synced_folder ".", "/usr/share/nginx/html", :mount_options => ["dmode=777", "fmode=774"]

My public folder config looks like this:

public_folder = "/usr/share/nginx/html/public"

Nginx is creating the file /usr/share/nginx/html/index.html

It'd be great if that isn't created at all (or created in some other default folder), but is there any reason it could be putting it in the root of the synced folder?

Edit: It does it before the new public folder/vhost is created. Even if the new vhost is never created.

Nginx installed on Debian/Ubuntu servers (when installed via
aptitude/apt-get) will always install the default debian index page on
/usr/share/nginx/html or /var/www/html.

Vagrant/Vaprobash can't change that. Any configuration done in the
vagrantfile, such as file share and default web root, take place separately
from Nginx - the only interaction is to set a web root within Nginx's
server configuration that Vaprobash creates for nginx at*
/etc/nginx/sites-available*.

The web root options within this project's Vagrantfile create a new
server/virtual host configuration that is separate from Nginx's default
installed one. If you check the server's /etc/nginx/sites-available
directory, you'll see one created by Vaprobash in addition to the default
one. Each will have it's own "root" directive with a document root defined.

Overall, however, I'm not really sure what you're trying to do. If you
can't use NFS, that's totally fine. I still suggest you keep the default
share of* config.vm.synced_folder ".", "/vagrant".*

Seeing your Bagrantfile might help clarify that, but I think I need to know
what your goal is here.

On Wed, May 27, 2015 at 12:19 PM Daniel Upshaw notifications@github.com
wrote:

Upon provisioning, Nginx is putting its "Welcome to nginx on Debian!"
default index.html file in the root of the synced folder, instead of the
document/public root. I can't figure out why.

Since I can't use NFS, my synced folder config looks like this:

config.vm.synced_folder ".", "/usr/share/nginx/html", owner: "www-data",
group: "vagrant", :mount_options => ["dmode=777", "fmode=774"]

My public folder config looks like this:

public_folder = "/usr/share/nginx/html/public"

Nginx is creating the file /usr/share/nginx/html/index.html

It'd be great if that isn't created at all (or created in some other
default folder), but is there any reason it could be putting it in the root
of the synced folder?


Reply to this email directly or view it on GitHub
#466.

Thanks so much for the info! That makes sense. The goal is to get the box pretty close to what it would be on a live site (usually for me it's a default digital ocean droplet with nginx). What I've done now is in nginx.sh, I check for the presence of index.html, and delete it if it wasn't there before nginx was installed.

Great work!

Sounds good! Glad you found a fix. 🍺