我对这件事很感兴趣,因此我要求你们在这件事上和我一起袒护。 相信我,我通常不会发问,直到我真正花了几个小时在一个问题上没有任何结果。 请原谅,如果我不熟悉服务器术语。 我会尽我所能来解释手头的情况。 所以这是事情。 我从一个nginx服务器为我的网站提供服务,并在服务器上安装了letsencrypt ssl证书。 我也在网上研究如何使redirect工作,因为我只希望https://www.example.com出现以下条目: www.example.com example.com http://example.com http://www.example.com https://example.com 它redirect了前4个,但不是最后一个,我不明白为什么。 它只是显示为https://example.com 这是我在过去几个小时一直在讨论的文件。 我在这里和那里改变了一些代码来获得我现在所处的状态(这比之前我认为的要好)。 所以如果你认为有些事情是closures的,那很可能是,我正在寻找正确的解决scheme。 [/etc/nginx/sites-enabled/example.com] server { server_name example.com; return 301 $scheme://www.example.com$request_uri; } server { listen 80 default_server; listen [::]:80 default_server; # SSL configuration # listen 443 ssl default_server; listen [::]:443 ssl default_server; # # Note: You should disable gzip for […]
我真的被困在这里,在相关的post里找不到帮助,这是我第一次和nginx打交道。 我在Synology NAS上安装了一个运行nginx的“Moodle”安装程序,并希望通过域名从外部访问,即我不想使用公共IP。 我已经有了一个域名(让我们说mymoodle.com),并添加了一个“Alogging”到这个域指向我的路由器的公共IP。 当我在浏览器中input“mymoodle.com”时,它指向了Synologynetworking文件夹的根目录,在我的情况下, /var/services/web/ 并包含以下内容: index.html moodle phpMyAdmin web_images 和我的浏览器基本上呈现index.html,所以我的Alogging似乎按预期工作,即mymoodle.com指向该文件夹中的index.html。 但我希望mymoodle.com指向moodle子文件夹(其中包含一个index.php文件)。 我发现Moodle的以下nginxconfiguration文件: /etc/nginx/conf.d/www.Moodle.conf 这看起来像: location ^~ /moodle { include proxy.conf; proxy_read_timeout 3600s; proxy_pass http://127.0.0.1:914; } 我尝试了一堆设置,但似乎没有工作。 我最后的尝试是这样的: server { server_name moodle.trucker.in; root /var/services/web/moodle; } 但当然没有成功。 / etc / nginx /的内容如下所示 ash-4.3# ls -l /etc/nginx/ total 52 lrwxrwxrwx 1 root root 20 Oct 9 […]
我正在用http2在443上运行带有ssl(tls)的Ubuntu 16.04 nginx服务器。 在我的网站上,Safari 11.0中的PDF文件链接失败,出现“networking连接丢失”错误。 如果我在/ etc / nginx / sites-available / default文件中更改了Safari,那么Safari下载文件listen 443 ssl http2 default_server; listen 443 ssl default_server; 但是,如果我尝试下载http而不是https,则下载文件。 是否有另一个configuration设置,将让Safari回退到http 1.1并下载文件? 版本信息是: nginx version: nginx/1.10.0 (Ubuntu) built with OpenSSL 1.0.2g-fips 1 Mar 2016 TLS SNI support enabled
这是我的nginx conf: server { root /var/www/html/public; location / { rewrite ^(.*)$ /index.php last; try_files $uri $uri/ /index.php?$query_string =404; } location = /path/file.php { root /var/www/html; try_files $uri $uri?$query_string =404; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.0-fpm.sock; } } 第一部分工作正常,所有的URL被redirect到/public/index.php。 但是,我无法访问/path/file.php。 使用当前configuration,它将下载文件而不是解释它。 我一直在玩,但与我试过的其他选项,请求得到/public/index.php处理。 我如何允许在根外部访问这个特定的文件?
我试图从源代码安装和configurationnginx上传模块: 运行时 ./configure –add-module=/tmp/nginx-upload-module-2.2.0 –with-openssl=/usr/bin/openssl 我有以下问题: checking for md5 in system md library … not found checking for md5 in system md5 library … not found checking for sha1 in system md library … not found 设置:ubuntu 16.04服务器,nginx-1.9.9,nginx-upload-module-2.2.0 任何人都知道如何设置path来find这些库? 任何意见,将不胜感激。
我有一个Ubuntu滴与以下内容: 16GB RAM 8个CPU 我正在运行nginx和PHP FPM,但是我似乎并没有从我的服务器中获得最大的收益。 我的CPU使用率和内存使用率都在10%左右,即使服务器在stream量变得密集时挂起。 nginx摘要: worker_processes:8 worker_connections:6000 epoll已启用 multi_accept开启 启用gzip并保持活动状态 php-fpm总结: 在我的www.conf文件中: 下午:dynamic 下午六点钟 pm.start_servers:75 pm.min_spare_servers:75 pm.max_spare_servers:90 其他一切都使用默认设置。 哦,我的ulimit被设置为99999,PHP的opcache被启用。 是否有任何清单,有人可以通过,以确保他们正在微调nginx和php-fpm充分利用服务器的资源?
我的nginx根目录是/ usr / share / nginx / html / ,我的Node.js应用程序位于/ root / app / 。 但是反向代理在nginx根目录下search应用程序。 我使用了以下位置块。 location /t { rewrite ^/t/(.*) /$1 break; proxy_pass http://127.0.0.1:3000; } 并将应用程序configuration中的基本uri更改为 baseURI: '/t' 但是我得到一个空白页面, 但标题栏显示“ AppName ” 这里是nginx错误日志 2017/10/26 16:41:43 [error] 3585#0: *5 connect() failed (111: Connection refused) while connecting to upstream, client: 49.206.123.228, server: _, request: "GET […]
我在OS X上使用NGINX和PHP-FPM设置了我的本地web dev服务器。我已经安装了两个服务,并为localhost域设置了一个虚拟的。 到目前为止一切正常。 nginx运行正常 它能够从为localhost server_nameconfiguration的自定义根目录读取文件 PHP文件处理正确 接下来我要设置的是localhost域中的/phpmyadminpath的别名。 我想要url http://localhost/phpmyadmin从/usr/local/share/phpmyadmin加载其内容,而不是从默认configuration的根目录。 我在本地主机服务器configuration中添加了这个位置块: location /phpmyadmin { alias /usr/local/share/phpmyadmin; include /usr/local/etc/nginx/conf.d/php-fpm; } 但http://localhost/phpmyadmin请求上的响应是404。 这里是我使用的configuration: /usr/local/etc/nginx/nginx.conf worker_processes 2; error_log /usr/local/etc/nginx/logs/error.log debug; events { worker_connections 1024; } http { include 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 /usr/local/etc/nginx/logs/access.log […]
我有一个片段,我使用的是我的所有网站,在静态网站上运行良好,但是在proxy_pass网站上没有那么多。 我不知道我做错了什么,我怎样才能安全地包含我的代码段而不使资产404? 这是我的服务器块 server { server_name jenkins.fabrikam.com; include /etc/nginx/location.conf; # All assets are 404 with this location / { proxy_pass http://localhost:8080; include /etc/nginx/proxy_params; } } 这里是location.conf # cache.appcache, your document html and data location ~* \.(?:manifest|appcache|html?|xml|json)$ { expires -1; } # Feed location ~* \.(?:rss|atom)$ { expires 1h; add_header Cache-Control "public"; } # Media: images, […]
我有一个Google Compute Engine实例,我想在nginx上托pipe多个网站。 我为每个网站设置了一个带有nginx,php7.1-fpm,mysql,phpmyadmin的LXD容器,最重要的是我有一个nginx容器作为反向代理。 所有这一切工作正常。 我的问题是,如果我可以删除与nginx的容器作为反向代理,并使用谷歌云服务redirectdomain1.com到容器1,domain2.com到容器2等…事情是,每个lxd容器只有一个内部IP地址。 你可以帮我吗?