是否可以在生产时完全禁用wagtail admin的url登录。因为我想在Bastian框中设置一个复制环境,所以我只允许在进行更改时使用我的IP地址
答案 0 :(得分:2)
您是否尝试从网址配置中删除管理网址?
# urls.py
urlpatterns = [
# uncomment the following line
# url(r'^admin/', include(wagtailadmin_urls)),
url(r'^documents/', include(wagtaildocs_urls)),
# For anything not caught by a more specific rule above, hand over to
# Wagtail's page serving mechanism. This should be the last pattern in
# the list:
url(r'', include(wagtail_urls)),
# Alternatively, if you want Wagtail pages to be served from a subpath
# of your site, rather than the site root:
# url(r'^pages/', include(wagtail_urls)),
]
答案 1 :(得分:0)
您可以阻止/允许Nginx中的IP地址
location /admin/ {
allow XXX.XX.XX.XX; ## Your specific IP
deny all;
}
答案 2 :(得分:0)
@ user8585282:如果您尝试在Nginx中过滤URI,则可以通过为您的站点编辑Nginx配置文件来实现(在Ubuntu中,该文件位于/ etc / nginx / sites-enabled / my-project)。 / p>
然后,在服务器块中,添加以下代码(您可以将IPv4和IPv6与CIDR一起使用)。
server {
...
#restricts wagtail admin to this IP CIDR Block
location = /admin {
include proxy_params;
proxy_pass http://unix:/run/gunicorn.sock;
allow XX.XX.XX.XX/24;
deny all;
}
#restricts django admin to this IP CIDR Block
location = /django-admin {
include proxy_params;
proxy_pass http://unix:/run/gunicorn.sock;
allow XX.XX.XX.XX/24;
deny all;
}
...
}