nginx phpmyadmin 針對內網ip用戶開放、外網ip用戶關閉(在前面的配置中,location ~ ^/目錄/使用正則, 優先級高於location /的配置,所以nginx無法對首頁進行解析)
代碼如下server {
listen 80;
server_name example.com;
access_log logs/access.log main;
location / {
root html;
index index.php index.html index.htm;
}
location ~ ^/phpmyadmin/ {
allow 192.168.1.0/24;
deny all;
location ~ .*.(php|php5)?$ {
root /var/mailapp/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
}
}
location ~ .*.(php|php5)?$ {
root /opt/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
}
}
我們也可以這樣配置
代碼如下 server {