FreeBSD7.0編譯安裝nginx+php+mysql
2024-06-01
更新時間:2024-06-02 00:06:50作者:未知
nginx phpmyadmin 針對內(nèi)網(wǎng)ip用戶開放、外網(wǎng)ip用戶關(guān)閉(在前面的配置中,location ~ ^/目錄/使用正則, 優(yōu)先級高于location /的配置,所以nginx無法對首頁進(jìn)行解析)
代碼如下 | |
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 { listen 80; server_name example.com; access_log logs/access.log main; location / { root html; index index.php index.html index.htm; } location ~ ^/download/ { allow 192.168.1.0/24; deny all; index index.php index.do index.html index.htm; 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)?$ { |