|
| 1 | +####### |
| 2 | +# PhpMongoAdmin - Web based MongoDB management written in php using Vue & Laravel |
| 3 | +# |
| 4 | +# WARNING !! PUBLIC ACCESS ENABLED !! |
| 5 | +# |
| 6 | +# Allowing PhpMongoAdmin to anyone other than localhost should be considered |
| 7 | +# dangerous unless properly secured by SSL |
| 8 | + |
| 9 | +####### |
| 10 | +# This configuration is meant for creating the default 'global' nested URL install using an Alias directive |
| 11 | +# It is NOT meant to be used for creating a Server Block (VirtualHost): http://my.phpmongoadmininstall.com |
| 12 | +# For a VirtualHost setup use the: setup/nginx/serverBlock/server_phpMongoAdmin.conf sample configutation |
| 13 | +####### |
| 14 | + |
| 15 | +####### |
| 16 | +# To use a custom configuration config: replace all instances of /usr/share/phpMongoAdmin/public |
| 17 | +# - with the real path to the installation that you created: /my/directory/path/to/public |
| 18 | +####### |
| 19 | + |
| 20 | +####### |
| 21 | +# custom: alias path configuration with custom install location |
| 22 | +####### |
| 23 | +# Alias /phpmongoadmin /var/hosting/sites/phpMongoAdmin/public |
| 24 | +## !! this configuration has not been added for Nginx !! |
| 25 | +# Alias /phpMongoAdmin /var/hosting/sites/phpMongoAdmin/public |
| 26 | + |
| 27 | +####### |
| 28 | +# default: these allow you to define the Real-Path to your installed application |
| 29 | +# If you change the URI ( /phpmongoadmin ) make you update the @phpmongoadmin RewriteBase to match |
| 30 | +####### |
| 31 | +server { |
| 32 | + listen 80; |
| 33 | + |
| 34 | + # web root |
| 35 | + root /usr/share/phpMongoAdmin/public; |
| 36 | + |
| 37 | + # defaults indexes |
| 38 | + index index.php index.html; |
| 39 | + |
| 40 | + # CORS |
| 41 | + add_header 'Access-Control-Allow-Origin' '*'; |
| 42 | + add_header 'Access-Control-Allow-Headers' '*'; |
| 43 | + add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS'; |
| 44 | + add_header X-Frame-Options "SAMEORIGIN"; |
| 45 | + add_header X-Content-Type-Options "nosniff"; |
| 46 | + |
| 47 | + # logging |
| 48 | + access_log /usr/share/phpMongoAdmin/storage/logs/phpmongoadmin_access.log; |
| 49 | + error_log /usr/share/phpMongoAdmin/storage/logs/phpmongoadmin_error.log; |
| 50 | + |
| 51 | + # default charset |
| 52 | + charset utf-8; |
| 53 | + |
| 54 | + # default 'alias' configuration |
| 55 | + ## ToDo: !! this isnt working as nicely as it does on Apache - stil needs some tweaking !! |
| 56 | + location /phpmongoadmin { |
| 57 | + alias /usr/share/phpMongoAdmin/public; |
| 58 | + try_files $uri $uri/ @phpmongoadmin; |
| 59 | + location ~ \.php$ { |
| 60 | + # if you encounter errors, check the path to php-fpm |
| 61 | + include fastcgi_params; |
| 62 | + fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; |
| 63 | + fastcgi_param SCRIPT_FILENAME $request_filename; |
| 64 | + } |
| 65 | + ## If this 'location' is moved outside the /phpmongoadmin alias then no /js/ or /css/ files are loaded |
| 66 | + ## With this location here it seemes to prevent our /js/acceptLang.js from loading with a 404 |
| 67 | + #location ~* \.(?:ico|js|css|png|jpe?g|gif)$ { |
| 68 | + # access_log off; |
| 69 | + # expires max; |
| 70 | + # log_not_found off; |
| 71 | + #} |
| 72 | + } |
| 73 | + |
| 74 | + # alias location rewrite |
| 75 | + location @phpmongoadmin { |
| 76 | + rewrite /phpmongoadmin/(.*)$ /phpmongoadmin/index.php?/$1 last; |
| 77 | + } |
| 78 | + |
| 79 | + # default php interpreter |
| 80 | + location ~ \.php$ { |
| 81 | + try_files $uri $uri/ /index.php?$query_string; |
| 82 | + # if you encounter errors, check the path to php-fpm |
| 83 | + include fastcgi_params; |
| 84 | + fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; |
| 85 | + fastcgi_param SCRIPT_FILENAME $request_filename; |
| 86 | + } |
| 87 | + |
| 88 | + # behaviour |
| 89 | + location = /favicon.ico { access_log off; log_not_found off; } |
| 90 | + location = /robots.txt { access_log off; log_not_found off; } |
| 91 | + |
| 92 | + # behaviour (not needed?) |
| 93 | + send_file off; |
| 94 | + |
| 95 | + # behaviour |
| 96 | + location ~* \.(txt|log|inc)$ { |
| 97 | + allow 127.0.0.1; |
| 98 | + deny all; |
| 99 | + } |
| 100 | + |
| 101 | + # 404 handling |
| 102 | + error_page 404 /index.php; |
| 103 | + |
| 104 | + # block phplist config directory |
| 105 | + location /config { |
| 106 | + deny all; |
| 107 | + } |
| 108 | + |
| 109 | + # remnant from apache |
| 110 | + location ~ /\.ht { |
| 111 | + deny all; |
| 112 | + } |
| 113 | +} |
0 commit comments