我是Nginx的新手。 我刚刚将一个网站(包括静态文件)从IIS迁移到Nginx,但由于这种情况,我的一些链接被破坏了。 请注意,我在Debian上安装了nginx。 我怎么能告诉Nginx这些链接是一样的: http://s2.example.com/some/folder/kmplayer.exe http://s2.example.com/some/folder/KmplayEr.exe 请注意,我不想小写我的文件(S)/文件夹(S)..我想使Nginx对待Kplayer.exe或kmpLayeR.exe Kplayer.exe相同,换句话说,我想禁用大小写区分大小写 请帮帮我。 我已经阅读了互联网上的所有文章,但他们没有解决问题。 我的服务器块configuration: server { listen 80; server_name www.s2.example.com s2.example.com; access_log /var/www/s2/logs/access.log; error_log /var/www/s2/logs/error.log; location / { root /var/www/s2; index index.html index.htm; } }
我正在跟着这个DigitalOcean教程 ,介绍Salt Cloud如何工作,以及两个应用程序服务器和一个反向代理。 最后的预期结果是,您应该在反向代理背后的两台机器上运行一个纯JS应用程序,告诉您应用程序的IP地址,这将显示这两个应用程序服务器正在运行并被代理。 不过,我只能得到Nginx的欢迎页面。 下面是nginxconfiguration文件,首先是模板,然后是生成的: 模板 ### /srv/salt/nginx/files/awesome-app.conf.jin ### ################################################## ### Configuration file for Nginx to act as a ### reverse proxy for an app farm. # Define the app servers that we're in front of. upstream awesome-app { {% for server, addrs in salt['mine.get']('roles:appserver', 'network.ip_addrs', expr_form='grain').items() %} server {{ addrs[0] }}:1337; {% endfor […]
我们使用nginx作为java应用程序的代理(都在docker容器中,但这可能不相关)。 当我们试图通过rest客户端到达Java应用程序的特定头部时,SM_USER在代理通过中丢失。 奇怪的是:如果我们使用CURL或者PHP Zend Framework或者Firefox rest add-on来做请求,那么proxy passconfiguration就起作用了。 但是,如果我们使用Java Springrest客户端或soapUI,头部会丢失。 如果我们绕过代理它也从Java / soapUI工作。 我们使用下面的nginxconfiguration: server { listen 80; server_name devrest.example.com; root /devrestserver; underscores_in_headers on; location / { proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass_request_headers on; proxy_pass http://devrest:8080; } } 正如你所看到的,我们使用underscores_in_headers; 并显式设置proxy_pass_request_headers; 在configuration中。 nginx接pipe之前的一个tcpdump显示了SM_USER头到达服务器: GET /resource/RoomType/ HTTP/1.1 Accept: text/plain, application/json, application/*+json, */* Content-Type: […]
在旧的共享服务器系统中,我的用户名为A.我的站点中的每个PHP脚本都使用我自己的用户名运行: $puser = posix_getpwuid(posix_geteuid())['name']; // = $puser = "A"; 现在我运行我自己的运行nginx的VPS,用户名/组是nginx。 然而,我已经创build了一个用户名B的朋友的帐户,我希望他创build的每个PHP脚本与用户B执行,而不是nginx。 基本上我希望每个PHP脚本都与创build它的同一个用户的UID一起运行。 用nginx可以吗?
背景 我厌倦了太贵,所以我决定用mattermostreplace它。 我得到了一个带有公共IP的AWS ubuntu盒子,并遵循了mattermost 安装说明 (主要的区别是我在同一台服务器上运行所有的东西,而不是单独的数据库服务器和存储服务器等等。所有运行在同一台机器上,即http://127.0.0.1 ) 我的域名(lobolabshq.com)由wixpipe理,所以我添加了一个子域名: mattermost.lobolabshq.com 我在AWS框中安装了mattermost服务器,然后设置nginx将请求代理到nginx服务器。 我的nginx代理configuration存储在/etc/nginx/sites-available/mattermost ,如下所示: upstream backend { server 127.0.0.1:8065; } proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=mattermost_cache:10m max_size=3g inactive=120m use_temp_path=off; server { listen 80; server_name mattermost.lobolabshq.com; location /api/v3/users/websocket { proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; client_max_body_size 50M; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header […]
我有两个应用程序在服务器上工作完美,直到我打算切换到HTTPS。 Nginxconfiguration为应用程序1: server_name abc.com my.abc.com static.abc.com 正在讨论应用2: server_name _; 在启用SSL之前,两个应用程序都在工作, App1 http://static.abc.com/some-assets.png App2 http://static.def.com/some-assets.png 启用SSL后 App1 https://static.abc.com/some-assets.png App2 https://static.def.com/some-assets.png 如果我尝试访问App2 https://static.def.com/some-assets.png现在也以某种方式指向App 1。 我试图挖掘,发现如果我replaceserver_name _; 用server_name static.def.com; 在应用程序2 Nginx的configuration开始工作。 我的问题是,如果你想通过HTTPS提供服务,Nginx是否需要明确定义域名? 或者是SSL握手失败等等,它的结果是这样的? 更新: Nginxconfiguration文件: abc.conf def.conf
我们一直在使用NGINX和php-fpm。 我们已经注意到一些请求通过最高命令挂了很长时间(10+,20+分钟…)。 此外,在访问日志条目(NGINX)中检测到一些可疑请求(我的意思是机器人),但是我不确定这些可疑请求是否与这些请求挂起或不存在有关。 所以我的主要问题是: 是否有可能(通过configuration或其他)将php-fpm PID关联到访问日志中的URL条目? 还是有什么工具可以帮助我完成这个任务? 附加信息: 我们有源代码,因为我们是主要的开发者。 提前致谢!
我在我的Web服务器上有以下文件: /var/www/html/–+ | +-misc–+ | | | +-misc1–+ | | | | | +-index.html | | | +-misc2–+ | | | | | +-index.php | | | +-misc3.php | +-wordpress–+ | +-index.php 我有Nginx的设置,使http://example.com/进入我的WordPress的安装。 在我以前的(Apache)设置中,我能够轻松地创build别名来指向misc的项目,但我不确定如何在Nginx中执行此操作。 index index.php index.html; root /var/www/html/wordpress; location ~ [^/]\.php(/|$) { limit_except GET POST {} fastcgi_split_path_info ^(.+?\.php)(/.*)$; if (!-f $document_root$fastcgi_script_name) { return 404; […]
我有一个使用Nginx Web服务器部署在Azure虚拟机上的应用程序。 应用程序使用主pipe设置Nginx和gunicorn服务器。 我已经检查了所有的configuration和日志文件,似乎都工作正常。 但是,当我指向浏览器在网站浏览器时间为www.mydomain.com和mydomain.com返回: This site can't be reached mydomain.com's server DNS address could not be found. 在Azure上,我设置了一个DNS区域,其中包含: Name: @ TYPE: NS TTL: 120 VALUE: relevant azure name servers. Name: www TYPE: CAME TTL 60 mydomain.com 在域名注册商,我已经根据azure色的DNS名称设置了DNS名称。 在我的本地机器上,我有: 刷新浏览器上的caching。 检查nslookup www.mydomain.com Server: 127.0.1.1 Address: 127.0.1.1#53 Non-authoritative answer: Name: www.mydomain.com Address: xxx.xxx.xx.xx 尝试traceroute,xxx.msn.net地址找不到任何[closures],所以我认为服务器被发现。 尝试: host […]
我有多个节点的websockets可以通过匹配的UNIX套接字path的URL。 而不是重复的位置指令,我想有一个像Url列表将被用作套接字名称。 使用正则expression式不起作用,因为我需要套接字名称的path。 目前我正在使用这个位置: location /application1/ { proxy_pass http://unix:/var/run/nodejs/application1; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } 目标是有这样的东西: $list = [app1, app2, app3]; #list of possible names location /$list/ #match all names in the list { proxy_pass http://unix:/var/run/nodejs/$list_matched; #use matched name proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } 基本上,列表中的每个URL都应redirect到具有相同名称的套接字。 在此先感谢您的帮助:)