Last active
August 14, 2022 20:49
Star
You must be signed in to star a gist
Demo files for nginx alias traversal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$user = 'appuser'; | |
$pass = 'secret'; | |
$db = new PDO('mysql:host=localhost;dbname=test', $user, $pass); | |
// ... | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. | |
├── docker-compose.yml | |
├── nginx.conf | |
└── webapp | |
├── app | |
│ ├── db.php | |
│ └── webroot | |
│ └── index.php | |
└── static | |
└── sample.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.7" | |
services: | |
web: | |
image: nginx:alpine | |
ports: | |
- 8081:80 | |
networks: | |
- internal | |
volumes: | |
- ./webapp:/var/www/webapp | |
- ./nginx.conf:/etc/nginx/conf.d/default.conf | |
depends_on: | |
- php | |
php: | |
image: php:fpm-alpine | |
volumes: | |
- ./webapp:/var/www/webapp | |
networks: | |
- internal | |
networks: | |
internal: | |
driver: bridge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo 'Here is the webroot'; | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
server_name _; | |
root /var/www/webapp/app/webroot; | |
index index.php index.html index.htm; | |
access_log /var/log/nginx/php-access.log; | |
error_log /var/log/nginx/php-error.log; | |
location /assets { | |
alias /var/www/webapp/static/; | |
} | |
location / { | |
try_files $uri $uri/ /index.php?$query_string; | |
location ~ \.php$ { | |
include fastcgi_params; | |
fastcgi_pass php:9000; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment