this post was submitted on 22 Jun 2023
3 points (100.0% liked)

Web Development

3434 readers
1 users here now

Welcome to the web development community! This is a place to post, discuss, get help about, etc. anything related to web development

What is web development?

Web development is the process of creating websites or web applications

Rules/Guidelines

Related Communities

Wormhole

Some webdev blogsNot sure what to post in here? Want some web development related things to read?

Heres a couple blogs that have web development related content

CreditsIcon base by Delapouite under CC BY 3.0 with modifications to add a gradient

founded 1 year ago
MODERATORS
 

Hi all. I'm looking to make a backend in my NGINX server, for a website that only gets a few views. Right now I'm managing the files of the site using Git, with /var/www/ as the folder on github. I'm looking to create an ip logger to plot onto a map, and I'm wondering if there are any problems with hosting it on /var/www. My main concerns are if it's accessible to other users or if it'll slow down NGINX. I'm absolutely able to do it in another folder, but I am wondering if there are any problems with keeping any files in /var/www. To my knowledge, only past /var/www/html is viewable by a connection.

Thanks!

top 5 comments
sorted by: hot top controversial new old
[–] thebardingreen@lemmy.starlightkel.xyz 2 points 1 year ago* (last edited 1 year ago) (1 children)

Slow down NginX

I don't see why it would, /var/www is exactly where I would put it.

Accessible to other users.

By default /var/www should be owned by root, with read and execute permissions for the webserver user and read permissions for other users (so that you can log in and look at the files without having sudo). If you want to be extra secure, change the group ownership to www-data (or whatever your nginx user is on that machine), then set

root rwx

www-data (group) r-w

all ---

[–] carrot@sh.itjust.works 1 points 1 year ago (2 children)

Sorry, by accessible to users I mean visitors. Some sort of example.com/../.git shouldn't be possible up to my knowledge.

[–] SteveTech@programming.dev 2 points 1 year ago (1 children)

You're right, unless there's some vulnerability, /var/www isn't accessible by visitors when /var/www/html is configured as the web root in nginx. However if they are files that visitors shouldn't access I probably wouldn't put them in /var/www, but I guess at least you could chmod them like the previous commenter said, so that nginx can't read them.

[–] carrot@sh.itjust.works 2 points 1 year ago

Ahh I see. I never considered the config file. Thank you for the help!

[–] msage@programming.dev 1 points 1 year ago

If you have a git folder anywhere, always put files accessible to public to /var/www/project/public and have document root point to the public directory.

nginx won't let users traverse upwards. Even if you only have static files, exposing /var/www/project as document root makes .git folder accessible.

If you have any server side processing, you put only the barest minimum in the project/public, as the server can load dependencies from project/src, but nginx won't let outsiders access those files.

load more comments
view more: next ›