Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nginx docker - php files are downloaded not executed. #12

Open
nikos-glikis opened this issue Apr 20, 2018 · 2 comments
Open

nginx docker - php files are downloaded not executed. #12

nikos-glikis opened this issue Apr 20, 2018 · 2 comments

Comments

@nikos-glikis
Copy link

Visiting a .php url results in downloading the file instead of running it.

How to reproduce:

#installed symfony cli tool:
sudo mkdir -p /usr/local/bin
sudo curl -LsS https://symfony.com/installer -o /usr/local/bin/symfony
sudo chmod a+x /usr/local/bin/symfony

#create a new symfony 3.4 project:
symfony new blog 3.4
cd blog
composer install --prefer-dist

#run ppm-nginx docker
docker run -v `pwd`:/var/www -p 8080:80 phppm/nginx

#visit .php file:
http://localhost:8080/web/app.php

This results in downloading the .php file and not running the code.

At least we should block downloading of .php and other relevant types. Ideally we should be able to run them.

Thanks

@marcj
Copy link
Member

marcj commented Apr 20, 2018

We should forbid them, not running them.

@nikos-glikis
Copy link
Author

nikos-glikis commented Apr 22, 2018

So something like

location ~\.(php|php3|php4|php5|php7|phtml|inc)$ {
     deny all;
     error_page 403 =404 / ;
 }

In the nginx conf or do you have anything else in mind ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants