Skip to content

Commit 4759588

Browse files
Merge branch 'staging'
2 parents 905e119 + ff5bd49 commit 4759588

7 files changed

Lines changed: 453 additions & 13 deletions

File tree

setup/apache/virtualHost/vhost_phpMongoAdmin.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#######
1010
# This configuration is meant for creating a Virtual Host implementation
11-
# It is NOT meant to be used for creating a Global install: http://my.ebdomain.com/phpmongoadmin
11+
# It is NOT meant to be used for creating a Global install: http://my.webdomain.com/phpmongoadmin
1212
# For a Global setup use the: setup/apache/global/phpMongoAdmin.conf sample configutation
1313
#
1414
# This script may be used in the automated installation process

setup/apache/virtualHost/vhost_phpMongoAdminPublic.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@
88

99
#######
1010
# This configuration is meant for creating a Virtual Host implementation
11-
# It is NOT meant to be used for creating a Global install: http://my.ebdomain.com/phpmongoadmin
11+
# It is NOT meant to be used for creating a Global install: http://my.webdomain.com/phpmongoadmin
1212
# For a Global setup use the: setup/apache/global/phpMongoAdmin.conf sample configutation
1313
#
1414
# This script may be used in the automated installation process
1515
#
1616
#######
1717

1818
#######
19-
# Creating a Virtual Host installtion requires some planning, due to the many possible locations for the application code
20-
#This virtualhost config uses a PATH structure that is useful for multiple web application deployments
19+
# Creating a Virtual Host installation requires some planning, due to the many possible locations for the application code
20+
# This virtualhost config uses a PATH structure that is useful for multiple web application deployments
2121
# Here are some viable alternative web root locations:
2222
# - /var/hosting/sites/phpMongoAdmin
2323
# - /usr/share/htdocs/phpMongoAdmin

setup/nginx/global/phpMongoAdmin.conf

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,58 @@
1+
#######
2+
# PhpMongoAdmin - Web based MongoDB management written in php using Vue & Laravel
3+
#
4+
# Allows only localhost or private neworks by default: (examples included)
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+
#######
131
server {
232
listen 80;
33+
34+
# web root
335
root /usr/share/phpMongoAdmin/public;
4-
index index.php;
536

37+
# defaults indexes
38+
index index.php index.html;
39+
40+
# CORS
641
add_header 'Access-Control-Allow-Origin' '*';
742
add_header 'Access-Control-Allow-Headers' '*';
843
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
944
add_header X-Frame-Options "SAMEORIGIN";
1045
add_header X-Content-Type-Options "nosniff";
1146

47+
# logging
1248
access_log /usr/share/phpMongoAdmin/storage/logs/phpmongoadmin_access.log;
1349
error_log /usr/share/phpMongoAdmin/storage/logs/phpmongoadmin_error.log;
1450

51+
# default charset
1552
charset utf-8;
1653

54+
# default 'alias' configuration
55+
## ToDo: !! this isnt working as nicely as it does on Apache - stil needs some tweaking !!
1756
location /phpmongoadmin {
1857
alias /usr/share/phpMongoAdmin/public;
1958
try_files $uri $uri/ @phpmongoadmin;
@@ -30,12 +69,24 @@ server {
3069
# expires max;
3170
# log_not_found off;
3271
#}
72+
73+
# allowed IP addresses and netorks
74+
allow 127.0.0.1;
75+
allow 192.168.1.0/24;
76+
allow 192.168.0.0/24;
77+
allow 172.0.0.0/8;
78+
allow 10.0.0.0/8;
79+
80+
# deny the rest
81+
deny all;
3382
}
3483

84+
# alias location rewrite
3585
location @phpmongoadmin {
3686
rewrite /phpmongoadmin/(.*)$ /phpmongoadmin/index.php?/$1 last;
3787
}
3888

89+
# default php interpreter
3990
location ~ \.php$ {
4091
try_files $uri $uri/ /index.php?$query_string;
4192
# if you encounter errors, check the path to php-fpm
@@ -44,23 +95,28 @@ server {
4495
fastcgi_param SCRIPT_FILENAME $request_filename;
4596
}
4697

98+
# behaviour
4799
location = /favicon.ico { access_log off; log_not_found off; }
48100
location = /robots.txt { access_log off; log_not_found off; }
49101

102+
# behaviour (not needed?)
50103
send_file off;
51104

105+
# behaviour
52106
location ~* \.(txt|log|inc)$ {
53107
allow 127.0.0.1;
54108
deny all;
55109
}
56110

111+
# 404 handling
57112
error_page 404 /index.php;
58113

59114
# block phplist config directory
60115
location /config {
61116
deny all;
62117
}
63118

119+
# remnant from apache
64120
location ~ /\.ht {
65121
deny all;
66122
}
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
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

Comments
 (0)