Nginx phpmyadmin is available for intranet ip users and for internet ip users (in the previous configuration, location ~ ^/Directory/use regular expressions with a higher priority than the location/configuration, so nginx cannot parse the homepage)
The code is as follows: |
Copy code |
Server { Listen 80; Server_name example.com; Access_log logs/access. log main; Location /{ Root html; 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; } } |
We can also configure it like this
The code is as follows: |
Copy code |
Server { Listen 80; Server_name example.com; Access_log logs/access. log main; Location /{ Root html; Index. php index.html index.htm; } Location ~ ^/Download /{ Allow 192.168.1.0/24; Deny all; 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 )? $ { Root/opt/nginx/html; Astcgi_pass 127.0.0.1: 9000; Fastcgi_index index. php; Include fastcgi_params; }
|
Restrict a specified connection to only allow access from a specified IP address