我需要設置的位置讓你的幫助沒有工作的ip,Nginx的位置讓預期
location /route {
deny [my-ip];
}
所以這個作品,它不會讓我訪問路線
拋出這個錯誤
403 Forbidden
nginx/1.10.0 (Ubuntu)
這...
location /route {
allow [my-ip];
deny all;
}
不會讓我的訪問,但它應該讓我訪問路線,不明白爲什麼,它表明這個錯誤
404 Not Found
nginx/1.10.0 (Ubuntu)
配置文件(航線上兩個例子):
# Add index.php to the list if you are using PHP
index index.php index.html index.htm;
server_name [my-domain];
location/{
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php?$query_string;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php7.0-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php7.0-fpm:
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
# Phpmyadmin Configurations
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
#fastcgi_pass 127.0.0.1:9000;
#fastcgi_param HTTPS on; # <-- add this line
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* ^/phpmyadmin/(.+\.
(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}
# Dealing with the uppercased letters
location /phpMyAdmin {
rewrite ^/* /phpmyadmin last;
}
location /logs {
deny [myip];
}
location /admin {
allow [myip];
deny all;
}
什麼叫「不允許你訪問路線」呢? –
它顯示了這404未找到 的nginx/1.10.0(Ubuntu的) – Janva
您可以共享一個更詳細的conf文件? –