Articles of nginx

NGINX在使用上行时没有响应

我试图通过nginx来平衡一个web应用程序,它可以正常工作,我的web应用程序会调用带有子path的服务。 例如它的工作 http://example.com/luna/ 但不是 http://example.com/luna/sales 我的nginx.conf user nobody; worker_processes auto; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; map $http_upgrade $connection_upgrade { default upgrade; '' close; } upstream lunaups { server myhostserver1.com:8080; server myhostserver2.com:8080; } server { listen 80; server_name example.com; proxy_pass_header Server; location = / { rewrite […]

服务静态文件时,Nginx使用错误的path

我正在尝试使用nginx + php-fpm来为我的覆盆子pi上的Owncloud服务。 我正在使用自定义安装path/mnt/usbstorage/Documents/owncloud ,并且想要使用URL http://myserver/owncloud/访问http://myserver/owncloud/ 。 我已经configuration了位置,我可以访问index.php 。 但是,CSS和JS文件没有被加载。 nginxconfiguration如下(我已经忽略了一些部分,以保持最小): upstream php-handler { server unix:/var/run/php5-fpm.sock; } server { listen 80; server_name _; location ^~ /owncloud { alias /mnt/usbstorage/Documents; client_max_body_size 10G; fastcgi_buffers 64 4K; gzip off; index /owncloud/index.php; error_page 403 /owncloud/core/templates/403.php; error_page 404 /owncloud/core/templates/404.php; location /owncloud { rewrite ^ /owncloud/index.php$uri; } location ~ ^/owncloud/(?:index|remote|public|cron|core|ajax|update|status|ocs/v[12]|updater/.+|ocs-provider/.+|core/templates/40[34])\.php(?:$|/) { […]

Nginx在启动时没有在/etc/security/limits.conf中设置fd限制

我有以下configuration来增加可用于所有用户的进程的文件描述符的数量。 cat /etc/security/limits.conf * hard nofile 65536 * soft nofile 65536 当机器启动时,nginx设置为在nginx用户下作为服务启动,如果我检查/ proc //限制下的限制,它是1024/4096 Max open files 1024 4096 files 在不更改任何设置或configuration文件的情况下,如果我使用sudo service nginx restart nginx服务 限制可达65536/65536 Max open files 65536 65536 files 无论如何,要确保它第一次启动这些限制?

发出nginxredirect并删除引用信息

我们正在检查nginxconfiguration中的几个垃圾引用,并且希望将他们的请求redirect到我们的主页。 问题在于nginx是作为redirect的一部分传递给原引用者,所以当redirect的请求进来时,引用者仍然存在,nginx发出另一个redirect。 例: 错误的网站链接到example.com/page.html 。 我们将该请求redirect到example.com因为我们不希望糟糕的引用者将stream量发送到我们的页面。 问题是,当nginx收到example.com的请求时,那个糟糕的引用者仍然存在,所以nginx发出另一个redirect,以此类推到无穷大。 如何从nginx发出redirect时清除原始引用者? 这是我们正在使用的相关块。 我们在configuration文件的http部分填充$bad_referer 。 if ($bad_referer) { return 302 http://www.example.com; }

Nginx重写/ product_category / WordPress

我正在尝试为WordPress / Woocommerce网站重写以下内容: /product_category/example-category/ /product/example-product/ 至… /example-category/ /example-product/ 使用以下规则: server { listen 10.99.0.3:8080; server_name www.example.com; root /home/www.example.com/public_html; index index.html index.htm index.php; rewrite ^/product-category/1$ /; rewrite ^/product/1$ /; include conf.d/whitelisted.conf; include conf.d/wp/restrictions.conf; include conf.d/wp/wordpress.conf; } …这是从一个单独的文件包含的wordpress.conf规则: location / { try_files $uri $uri/ /index.php?$args; } rewrite /wp-admin$ $scheme://$host$uri/ permanent; location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ { access_log off; log_not_found off; […]

YouTrack不适用于nginx代理

我正在尝试使用以下命令运行YouTrack实例: java -Xmx1g -XX:MaxPermSize=250m -Djava.security.egd=/dev/zrandom -Djava.awt.headless=true -Djetbrains.youtrack.baseUrl=http://localhost/yt -Djetbrains.youtrack.disableBrowser=true -jar /opt/youtrack.jar 3579 而我有一个nginx代理(不相关的nginxconfiguration部分被省略): upstream youtrack { server localhost:3579; } server { listen 80 default_server; listen [::]:80 default_server; server_name localhost; root /usr/share/nginx/html; location / { root /var/www/main; index index.html; } location /yt { rewrite /yt(.*) /$1 break; proxy_pass http://youtrack; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; […]

尝试将HTTPredirect到nginx中的HTTPS作为jenkins的反向代理时,从服务器返回空回复

我正在Jenkins后面运行Jenkins,并使用Let's Encrypt来获得SSL证书。 如果我通过https://jenkins.mydomain.de/访问该网站,一切工作正常。 但是,当我通过http://jenkins.mydomain.de/访问它,Firefox说:“连接被重置。”和curl说:“从服务器的空回复” 我如何debugging? 我真的不知道该在哪里寻找问题。 nginx日志不包含任何关于它的事情。 我怀疑在下面的configuration中关于端口80的部分是由其他指令无效,但我不知道我将如何调查。 $ curl -svL http://jenkins.mydomain.de/ * Hostname was NOT found in DNS cache * Trying my.ip.add.ress… * Connected to jenkins.mydomain.de (my.ip.add.ress) port 80 (#0) > GET / HTTP/1.1 > User-Agent: curl/7.38.0 > Host: jenkins.mydomain.de > Accept: */* > * Empty reply from server * Connection #0 to host […]

运行NGINX作为用户目录服务的权限错误

运行: CentOS 7,NGINX 1.10.0 运行NGINX为“用户{用户名}”时收到许可错误; 与以下文件夹结构和分配的权限: /家庭/ {用户名} drwxr-xr-x. 4 {username} {username} 88 Sep 28 04:21 . drwxr-xr-x. 4 {username} {username} 30 Sep 28 04:21 example.com /home/{username}/example.com drwxr-xr-x. 2 {username} {username} 6 Sep 28 07:15 logs –currently empty drwxr-xr-x. 2 {username} {username} 6 Sep 28 04:21 public –currently empty sudo nginx -t nginx: the configuration […]

Adobe ExtendScript http请求失败:没有共享密码

从我的Adobe ExtendScript脚本中,我尝试通过https调用REST API: var xmlhttp = new XMLHttpRequest(); xmlhttp.open('GET', 'https://***/api/books', true); xmlhttp.setRequestHeader('Authorization', 'Basic NDI5MDk…'); xmlhttp.send(null); if(xmlhttp.status == 200) { alert(xmlhttp.responseText); } 该代码在控制台中触发以下输出: net::ERR_SSL_VERSION_OR_CIPHER_MISMATCH 看另一边的nginx服务器日志,只有一个错误信息: 2016/09/29 11:25:34 [info] 7048#7048: *4396957 SSL_do_handshake() failed (SSL: error:1408A0C1:SSL routines:ssl3_get_client_hello:no shared cipher) while SSL handshaking, client: **.**.**.**, server: 0.0.0.0:443 其他客户端连接到服务器没有问题。 Web服务器非常稳定,维护良好,运行TSL 1.2并支持所有安全密码: 443/tcp open https | ssl-enum-ciphers: | TLSv1.2: | ciphers: […]

为什么在使用应用程序时,会select使用Nginx的Apache?

我看到这个问题,这让我想知道, 我知道 Apache和nginx之间的基本差异 – 但是他们如何与其他正在运行的应用程序交互有什么区别?