Articles of nginx

反向代理使用Nginx来使用nginx托pipewordpress应用程序

我试图使用nginx作为反向代理( 服务器A )到我的WordPress服务器( 服务器B )托pipe使用Nginx。 我正在试图设置我的url在一个子目录格式,如example.com/blog 它有点作品,但有一些问题。 服务器A具有LetsEncrypt SSL证书,因此它会在所有路由上强制使用https 。 这是一个问题,因为我的wordpress应用程序正在http上加载.js&.css文件。 成功login后,不是redirect到example.com/blog/wp-admin ,而是转到example.com/wp-admin 我的服务器一个 nginx conf文件,包含相应的位置块, location /blog { rewrite ^/blog/(.*)$ /$1 break; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_pass http://ip-address-for-server-b; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } 我的服务器B的 nginx conf文件 server { listen 80 default_server; listen [::]:80 default_server; root /var/www/html; index index.php index.html index.htm […]

nginx错误login自定义位置导致权限被拒绝(启动时)

我在CentOS 7.x中使用AWS EC2(c3.xlarge)实例,这些是我的挂载点: [centos@ip-10-0-4-119 ~]$ df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 8.0G 1.5G 6.6G 18% / devtmpfs 3.6G 0 3.6G 0% /dev tmpfs 3.5G 0 3.5G 0% /dev/shm tmpfs 3.5G 17M 3.5G 1% /run tmpfs 3.5G 0 3.5G 0% /sys/fs/cgroup /dev/xvdb 40G 49M 38G 1% /mnt tmpfs 707M 0 707M 0% […]

响应头会影响Chrome如何处理页面?

我有一个反向代理模式转发请求到NGINX的Squid代理,我想删除所有的信息,有关的Web服务器,代理等头目前我有Via头, caching控制头, 服务器头,和夫妇更多。 我实际需要的唯一头是caching控制,我想摆脱其余的。 我可以很容易地从Squid中删除标题,但是当我这样做需要1分钟来加载页面…我认为Chrome需要一些标题才能正常工作。 有人可以请解释,如果任何标题是特别重要的Chrome或我的问题是在别的地方? 我真正想要删除的标题是服务器标题和Via标题… 谢谢

tcp / ip连接错误

我们有一个128GB主内存的web服务器,在Ubuntu 16.04上有32个vCPU。 它运行nginx,php-fpm,postgresql,mysql和beanstalkd应用程序。 当networking服务器获得高吞吐量stream量时,networking服务器会给出来自不同应用程序的连接错 在平时,一切都好。 PostgreSQL的: [PDOException] SQLSTATE[08006] [7] could not connect to server: Connection timed out Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432? MySQL的: [PDOException] SQLSTATE[HY000] [2002] Connection timed out Beanstalkd: fwrite(): send of 8192 bytes failed with errno=32 Broken pipe 服务器(sysctl.conf可能)的哪些设置会影响这些限制? 我怎样才能增加这些限制,以避免错误?

Nginx的。 有条件地logging超过3秒钟的Web请求

有没有一种方法可以有条件地logging超过3秒的Web请求? 谢谢。

Nginx上传模块 – upload_store回退

我有2个驱动器om我的服务器,hdd和ssd。 我的目标是尽可能将所有file upload到ssd,但如果它不可写入(例如,驱动器已满),则会将file upload到硬盘驱动器。 我目前使用nginx的上传模块,具有以下configuration: location /upload { … upload_store /var/tmp/fuploads; } 有什么办法可以回upload_store参数吗?

反向代理背后的matrix突触产生“指纹问题”错误

我想build立一个反向代理的nginx背后的Synapse实例。 由于nginx是使用HTTPS的TLS设置的,所以这个有些过时的blogpostbuild议使用nginx vhost中已经使用的TLS东西来设置matrix突触,因为这是其他服务器在与我的实例交谈时将看到的TLS内容。 到目前为止,我已经成功地设置了服务器,以便它自己运行,并且此实例上的用户可以相互交谈。 主要的问题是服务器 – 2 – 服务器通信,或者像matrix家伙称之为“联邦”。 这是我在matrix突触中的TLS设置: tls_certificate_path: "/var/lib/acme/live/matrix.simonszu.de/fullchain" # PEM encoded private key for TLS tls_private_key_path: "/etc/matrix-synapse/homeserver.tls.key" # PEM dh parameters for ephemeral keys tls_dh_params_path: "/etc/ssl/dhparams/matrix.simonszu.de_dhparams.pem" # Don't bind to the https port no_tls: True 上面的tls_private_key_path表明,你可以完全注释掉tls_private_key_path ,因为你已经把no_tls设置为True(因为每个TLS的东西都是由nginx实例pipe理的)。 我已经注意到,这并不是真正的工作,因为在这种情况下,matrix突触将在隐蔽的地方search密钥文件。 由于密钥pipe理是通过acmetool从Let's Encrypt获取证书来完成的,并且如果对密钥文件设置了除0600之外的其他任何文件权限,则自动续订过程将失败,因此我无法链接到与证书关联的密钥文件。 但是由于TLS的东西无论如何都由nginx来pipe理,所以synapse只需要这个证书用于其他突触实例的指纹显示,并且有效地忽略了key_path。 我已经确定这个突触实例可以通过浏览器访问,并且可以手动获取签名。 但不幸的是,与其他实例进行通信时的初始握手失败。 我有自己的突触实例(不是在一个反向代理后面)访问另一个主机,我可以在握手过程中查看它的日志文件。 我的日志文件中出现以下错误: SynapseError: 401: No key for matrix.simonszu.de […]

Nginx的configuration问题

让我的Nginx网站正确显示,遇到很多麻烦。 我一直在404错误,现在我得到一个Connection Refused错误。 这是我的Nginxconfiguration user www-data; worker_processes auto; pid /run/nginx.pid; events { worker_connections 768; } http { sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; server_names_hash_bucket_size 64; include /etc/nginx/mime.types; default_type application/octet-stream; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE ssl_prefer_server_ciphers on; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; gzip on; gzip_disable "msie6"; include /etc/nginx/conf.d/*.conf; include […]

Nginx反向代理 – 代码404旁路服务器

我想知道是否有一种方法来设置NGINX反向代理服务器绕过404(或其他错误代码)响应的列表中的服务器。 我有一个集群映像板,通过6个不属于群集的专用服务器进行批量导入,因为它们不使用共享存储。 将映像导入到实时系统时,作为群集一部分的其他服务器显然将响应404,因为它们无法访问驻留在导入服务器上的文件。 有没有一种方法可以将它们添加到NGINX的列表中,它会忽略那些使用404响应的服务器,并使用正确响应的服务器? 我的NGINXconfiguration反向代理: upstream sequenzia-press { # server node-end1:80; server node1:80; server node2:80; server node3:80; server node4:80; } upstream sequenzia-cpu { server node1:80; server node2:80; server node3:80; server node4:80; } server { listen 80; root /var/www/html; server_name sequenzia.acr.moe; rewrite ^ https://$server_name$request_uri? permanent; } server { listen 443 ssl; root /var/www/seq; server_name sequenzia.acr.moe; ssl_certificate […]

nginx在向上游添加新的一堆之后重新向上游大量的TIME_WAIT添加到一些服务器

我有nginx上游的redis服务器(5台服务器上有4个redis实例),如下所示: upstream redis_cluster { server 10.0.1.8:6379 fail_timeout=0; server 10.0.1.8:6380 fail_timeout=0; server 10.0.1.8:6381 fail_timeout=0; server 10.0.1.8:6382 fail_timeout=0; server 10.0.1.6:6379 fail_timeout=0; server 10.0.1.6:6380 fail_timeout=0; server 10.0.1.6:6381 fail_timeout=0; server 10.0.1.6:6382 fail_timeout=0; … keepalive 16; } 在添加最后一个服务器(实际上是最后4个redis实例)之后,我注意到了一些奇怪的连接: 9684 10.0.0.17:6379 TIME_WAIT 3 10.0.0.17:6380 ESTABLISHED 9677 10.0.0.17:6380 TIME_WAIT 9664 10.0.0.17:6381 TIME_WAIT 6 10.0.0.17:6382 ESTABLISHED 9660 10.0.0.17:6382 TIME_WAIT 4 10.0.1.3:6379 ESTABLISHED 1 […]