我有一个网站,最近已经迁移到一个新的服务器。 旧的服务器在nginxconfiguration中有一个proxy_pass,以确保由于旧的DNS而导致到那里的任何请求被路由到新的服务器。 现在已经过去了几天,我仍然看到一些访问日志中的旧服务器stream量。 是否有一个特定的头部可以添加到旧服务器提供的响应中,以指示该主机的IP应该刷新? 也许一个caching控制:无caching或过期? 或者,也许是一个标题,指出新的IP?
示例情况。 我有一个IPV4地址的networking服务器。 我主持了50个网站,其中只有两个有SSL证书。 我已经为2个SSL网站configuration了虚拟主机,除了一个大问题,一切都还好,如果我使用https://前缀访问其他48个站点(他们没有SSL证书),我看到我的最新网站有一个SSL证书。 在非SSL网站上可以阻止https前缀? 或者只有一个解决scheme – 使用专用的IP地址。 如果我有专用的IP地址,我正在使用以下configuration: server { listen 111.222.333.444:443 ssl; } 这样,如果我强制https在非SSL网站 – 没有任何反应。
我有一个configuration来redirect我的所有本地API调用(从一个客户端,与apikey标题)在example.com到一个远程API服务器distant-api-server.com:8000 )。 upstream api-server { server distant-api-server.com:8000; } server { listen 80; index index.html; server_name example.com; location ~ /api/(?<path>.*) { if ($request_method = OPTIONS ) { add_header 'Access-Control-Allow-Origin' "$http_origin"; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; add_header 'Access-Control-Allow-Headers' 'apikey'; return 200; } if ($api_route = "error"){return 501;} error_page 501 /501_apikey.html; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT'; add_header […]
我设法用LE创build了我的证书,没有错误,我也设法将我的stream量从端口80redirect到端口443.但是当我重新加载我的nginx服务器时,我无法访问我的网站。 Ngnix错误日志显示以下行: 4 no "ssl_certificate" is defined in server listening on SSL port while SSL handshaking, client: 192.168.0.104, server: 0.0.0.0:443 我想这意味着它找不到证书,然后导航到证书的path,他们都在那里,可能是什么问题? 下面是我的Ngnixconfiguration的样子: server { listen 80; server_name pumaportal.com www.pumaportal.com; return 301 https://$server_name$request_uri; } server { listen 443 ssl; server_name pumaportal.com www.pumaportal.com; add_header Strict-Transport-Security "max-age=31536000"; ssl_certificate /etc/letsencrypt/live/pumaportal.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/pumaportal.com/privkey.pem; ssl_stapling on; ssl_stapling_verify on; access_log /var/log/nginx/sub.log combined; […]
我想在基于Nano Server的Docker容器中运行nginx。 如果我使用Windows Server Core作为基础,但是如果使用Windows Nano服务器,nginx.exe会立即退出,代码为-1073741515(0xC0000135),Web告诉我的意思是“应用程序未能正确初始化”。 没有输出打印。 我尝试使用nginx 1.11.13和Windows Nano Server 10.0.14393.1066。 在某些时候,微软发布了一个包含Nginx和Nano Server 的示例容器映像 ,但似乎并没有被维护,并且已经过期了7个月,所以对我来说并不是很有用。 我也无法find他们如何生成这个容器图像的任何指示,以便我可以尝试使用最新的组件来重现它。 为了使Nginx能够在基于Nano Server的容器中工作,我需要做些什么?
我的Web服务器上有一个部署系统,每次部署一个应用程序时,它会创build一个新的时间戳目录,并将“当前”符号链接到新目录。 在apache上这一切都很好,但是在我设置的新的nginx服务器上,它看起来像是一个来自“旧”部署的脚本,而不是新的符号链接的脚本。 我已经阅读了一些教程和post,如何解决这个问题,但没有太多的信息,似乎没有任何工作。 这是我的虚拟主机文件: server { listen 80; server_name ~^(www\.)?(?<sname>.+?).testing.domain.com$; root /var/www/$sname/current/public; index index.html index.htm index.php; location / { try_files $uri $uri/ /index.php$is_args$args; } location ~* \.(jpg|jpeg|gif|png|bmp|ico|pdf|flv|swf|exe|html|htm|txt|css|js) { add_header Cache-Control public; add_header Cache-Control must-revalidate; expires 7d; } location ~ \.php$ { #fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php/php7.1-fpm.sock; include fastcgi_params; fastcgi_param DOCUMENT_ROOT $realpath_root; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_index index.php; […]
我正在使用Fail2Ban,并根据需要进行了configuration。 这是从nginx / error.log读取日志,并根据configuration关于maxretry和时间设置。 问题是这是可能有不同的规则,取决于状态代码? 例如,我想阻止任何人在5分钟内获得10 404 Status code ,但是阻止任何获得3 403 Status code 。 任何帮助将不胜感激,在此先感谢。
因此,为了防止对我的phpmyadmin安装的蛮力攻击,我configuration了nginx以要求HTTP基本身份validation(额外的用户名和密码),然后请求需要来自列入白名单的IP地址。 然而,IP地址白名单工作正常,如果我运行https://example.com/phpmyadmin/,但不添加额外的.php块,我可以加载https://example.com/phpmyadmin/index.php没有我的IP列入白名单。 此问题不会影响HTTP基本身份validation。 这有什么原因吗? 无论如何,以避免不得不添加额外的.php块? 下面是phpmyadmin的configuration区域的副本。 # Setup and secure phpMyAdmin location /phpmyadmin/ { allow 1.2.3.4; deny all; auth_basic "phpMyAdmin – HTTP Basic Login"; auth_basic_user_file /etc/nginx/pma_pass; location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.0-fpm.sock; allow 1.2.3.4; deny all; } }
我们有几个WordPress网站正在开发中。 为了让我们的客户看看进度,我们不得不修改客户本地机器的hosts文件。 这不是最好的方法…另一个问题:WordPress总是将调用redirect到在设置中设置的域,所以使用替代域(nginx: server_name )不起作用。 那么,nginx有没有办法将所有的customer.com请求路由到development.com ? 例如:客户呼叫customer.com ,其DNS指向开发服务器。 然后,Nginx将所有来自customer.com请求路由到development.com ,这样WordPress就不会与customer.com联系,而且客户只能在他的浏览器中看到customer.com 。
我有两个域在同一台服务器上托pipe。 在DNSlogging中我有通配符(*)两个域的logging指向服务器。 所以我期待xyz.domain1.comparsing到domain1.com和xyz.domain2.com到domain2.com 。 不过目前除了domain2.com上的www子域名之外的所有内容都被redirect到了domain1.com 。 我有两个相同的nginxconfiguration域,所以我不明白是什么原因造成的。 这是我的nginxconfiguration看起来像 – user nginx; worker_processes 1; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr – $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /dev/stdout main; sendfile on; keepalive_timeout 65; # Listen for non-HTTPS requests […]