Eugeny / ajenti-v

Virtual Hosting addon for Ajenti
ajenti.org/#product-ajenti-v
MIT License
225 stars 80 forks source link

"Access denied." on certain files #231

Closed bbbenji closed 6 months ago

bbbenji commented 8 years ago

Ever since removing the PHP plugin and installing the PHP5.6 and PHP7.0 plugin I have been having issues with not being able to view certain files. I have attempted to set security.limit_extensions but this does not resolve the problem.

2016/05/12 12:05:08 [error] 7059#7059: *26 FastCGI sent in stderr: "Access to the script '/srv/example/index.txt' has been denied (see security.limit_extensions)" while reading response header from upstream, client: 82.177.68.16, server: example.com, request: "GET /index.txt HTTP/1.1", upstream: "fastcgi://unix:/var/run/ajenti-v-php7.0-fcgi-360-php7.0-fcgi-0.sock:", host: "example.com"

Examples: http://example.com works (contains index.php) http://example.com/index.php works http://example.com/index.html does not work http://example.com/index.txt does not work http://example.com/index does not work (contains index.php) http://example.com/index/ works (notice the trailing /) http://example.com/index/index.php works

No configuration has been done other than adding PHP 7.0 (alternatively 5.6) FastCGI to Content and attempting to set security.limit_extensions

bbbenji commented 8 years ago

Resolved https://github.com/Eugeny/ajenti-v/pull/213#issuecomment-218722433

Ardakilic commented 8 years ago

Actually, I think this may be re-opened, since you're not the only one and I wonder if anyone else is struggling from the same issue and it should be re-considered. My comment is just a workaround-ish.

Does it also happen on clean installs ?

bbbenji commented 8 years ago

@Ardakilic Yes, perhaps the plugins should default to \.php$ Regex or [^/]\.php(/|$) Regex

Have not tried on clean install.

Ardakilic commented 8 years ago

I can confirm this also happens on fresh installations, I think this should be re-opened because unless you know what to put there you have no idea of whether it can be run or not.

@bbbenji can you please re-open, or @Eugeny , should I open a new issue?

Ardakilic commented 8 years ago

Thanks man! 🙇

edioi commented 8 years ago

Hi Ardakilic @Ardakilic I've almost spent 3 days on this access 403 see security.limit_extensions error with Ubuntu 16.04.1 LTS. As it comes with php 7. I've tried to edit the www.conf(security.limit_extensions), php.ini(cgi.fix), different nginx conf but none of them works. I hope I could see your post earlier but after change to to .php$ Regex or [^/].php(/|$) Regex in the content, this problem still there, I also tried to restore what I have done before to default. Can you give me some hints as new to php7 and ajenti. Really appreciated.

Ardakilic commented 8 years ago

@edioi I set the content \.php$ and content type regex, and it works on Ubuntu 14.04 directly. 403 is a different error (forbidden / access denied) so something else should be the reason of yours. I usually get 502 if I mess up the nginx and fpm config.

edioi commented 8 years ago

Hi @Ardakilic, thanks for the help I sort it out although the answer sounds simple. You're right on a fresh installed ajenti, set [^/].php(/|$) and regex in the content type is enough to make it work (Ubuntu 16.04.1 LTS). I didn't notice the error.log changed from see security.limit_extensions error to 13 permission denied until this morning. This is the test server, so I copied some site from the /srv to this test server and I am quite sure I've done the ownership and permission thing, checked by ls -l. I deleted the copied data and created the directory from ajenti general directly and uploaded file by FTP and then everything works fine. I don't understand why but hope some one can point it out to me. No need to give +x to files as somewhere mentioned that.