我正在删除所有caching文件和未使用的文件,因为我的AWS实例现在达到100%的容量。 我的设置是Nginx服务,虽然php5-fpm与操作码caching。 我在nginx conf中启用了access_log main。 应该删除这个文件是否安全?
如何在没有扩展名的情况下在nginx服务器上请求html页面? 即:example.com/about应该返回example.com/about.html。 这应该是所有的HTML页面。 我有以下几点: try_files $uri $uri.html; index index.html; 哪些工作,但访问example.com/导致403禁止: 2015/01/20 19:26:11 [error] 32618#0: *373061 access forbidden by rule 并访问一个不存在的页面(example.com/bla)导致redirect循环: 2015/01/20 19:26:57 [error] 32620#0: *373065 rewrite or internal redirection cycle while internally redirecting to "/bla.html.html.html.html.html.html.html.html.html.html.html" 更新完整的nginxconfiguration: server { listen [::]:80; server_name example.com; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; root /var/www/example/; try_files $uri $uri.html /index.html =404; index index.html; […]
我试图通过Filezilla与我的本地用户进入一个NGINX文件夹。 我的服务器的操作系统是CentOS 7.我这样安装了vsftpd: #Install VSFTP sudo yum -y install vsftpd #Make Log file sudo mkdir /var/log/vsftpd sudo touch /var/log/vsftpd/vsftpd.log sudo chmod 0777 /var/log/vsftpd/vsftpd.log #Make SSL/TLS certificate; Pem file sudo openssl req -x509 -days 365 -newkey rsa:2048 -nodes -keyout /etc/vsftpd/vsftpd.pem -out /etc/vsftpd/vsftpd.pem #Update the SELinux boolean values for FTP service; getsebool -a | grep ftp sudo […]
这里有点疯了,把我的头发拉出来。 http://alpha.draser.co.uk上的网站适用于IE和Firefox(仅testing这些),不适用于Chrome。 我已经在我的电脑和远程服务器上testing过这个问题,并发生同样的问题。 alpha.draser.co.ukconfiguration server { listen 37.230.100.89:80; root /var/www/draser/alpha/public; index index.php index.html index.htm; server_name alpha.draser.co.uk; location / { try_files $uri $uri/ /index.php$is_args$args; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } }` draser.co.ukconfiguration server { listen 37.230.100.89:80; if ($http_referer ~* (buttons-for-website.com)) { return 444; } server_name www.draser.co.uk draser.co.uk; return […]
我在Drupal应用程序上收到一些零星的高服务器负载(真的很高,8个内核,平均负载为50)。 负载通常在5-10之间。 Drupal应用程序位于一个单独的Varnish服务器后面,这让大多数匿名用户都看起来很蠢。 Drupal应用程序本身是相当重的(在这方面工作,但我们有更多的直接需求)。 当我们以前遇到这个问题时,匿名用户绕过了Varnih。 我可以看到,在这段时间内,对Nginx的请求(绕过Varnish)的数量正在增加,但我不知道该怎么做。 我也确定这些时期的authentication用户数量没有显着增加。 如何解决这个问题?
我想要return 301 https://$host$request_uri; 仅在less数情况下才能执行。 我知道nginx不支持&&或|| 在条件和这对我来说是一个问题。 我托pipe一个Rails应用程序,添加SSL支持的最简单的方法,并强制我的用户总是使用https是通过更改我的configuration server { listen <my ip>:80; server_name mydomain.tld; return 301 https://$host$request_uri; } … upstream my_backend { server 127.0.0.1:9005; } server { listen <my ip>:443; server_name mydomain.tld; ssl on; …. location / { proxy_pass http://my_backend; } } 这工作正常,但是我们的一个大客户使用Lotus Notes,当他们阅读我们的引用像<img src="https://mydomain.tld/some-image.png" />资源的新闻稿时,他们看不到任何东西, IE在后台渲染,他们的旧IE版本没有SNI支持,IE拒绝渲染图像,一切看起来像一团糟。 所以我决定不使用在我们的新闻简报提到https而是使用http 。 所以我想出了这个configuration: server { listen <my ip>:80; […]
我有一个运行nginx的服务器,在启用了站点的地方有多个项目。 问题来了,当试图访问和不存在的项目URL,Nginx将呈现第一可用。 例如,我有一个服务器与IP 111.222.333.444和NGINX与那些项目: aaa.test.com bbb.test.com ccc.test.com 我现在正在创build一个新的域,是ddd.test.com,并指向111.222.333.444当试图访问ddd.test.com,我的浏览器将打开aaa.test.com 任何想法为什么? 在我的nginx项目configuration我有aaa.test.com server { listen 80; server_name aaa.test.com; access_log /usr/local/nginx/logs/aaa.access.log; error_log /usr/local/nginx/logs/aaa.error.log; root /var/www/aaa/web; client_max_body_size 60M; location / { index app.php; if (-f $request_filename) { break; } rewrite ^(.*)$ /app.php last; } ## Parse all .php file in the /var/www directory location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(.*)$; […]
我正在尝试在nginx中使用以下configuration进行proxy_pass: location /abc_service { proxy_pass http://127.0.0.1:3030; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } 但我得到/ abc_service作为前缀在我的应用程序(rails应用程序运行在端口3030)。 例如:我得到'/ abc_service / users / sign_in'应该是'/ users / sign_in' 我想删除这个前缀。 它在Apache中工作正常: ProxyPass /abc_service http://localhost:3030 timeout=300 KeepAlive=On ProxyPassReverse /abc_service/ http://localhost:3030/
在我的域名上,我有一个Meteor应用程序的子域 http://meteor.example.com/ 在此之下,我想个人应用程序,每个应用程序的URI。 说meteor应用聊天应该有这个url: http://meteor.example.com/chat/ 这是我的configuration: location ~ /chat/(.*) { proxy_pass http://127.0.0.1:4000/$1; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_set_header X-Forwarded-For $remote_addr; if ($uri != /snake_meteor/) { expires 30d; } } 我按照这个指南来configuration它。 现在,这部分工作。 它将请求传递给应用程序,并返回页面的正确的HTML,但是随后出现问题。 返回的HTML引用资源文件,如JS,CSS和图像。 HTML中的引用不幸的是在表单上 <script src="/somescript.js"></script> 所以它的要求 http://meteor.example.com/somescript.js 绝对path… 在应用程序中更改它们并不是一个真正的select。 也不能将资源放在域的根目录下。 有什么我可以在Nginxconfiguration中做到这一点工作? 或者我有其他方式做这个,像另一个子域的水平? 编辑:我的一个朋友build议检查参考头。 它部分地工作。 一些文件被提取,但build立一个websocket和其他一些东西失败。 我为此添加的configuration是 location / { if ($http_referer […]
我有nginx作为LB. 而2阿帕奇作为networking服务器。 比方说,我有不同的领域: www.example.com checkout.example.com 两个域将在同一个Apache服务器上。 但是在不同的目录下。 以及Apache vhost文件上的不同VHost文件。 像下面这样的devise: Nginx | ————- | | Apache Apache 下面是我现有的Nginx .conf文件,它不适用于第二个域(checkout.example.com)。 来自NGINX(mysites.conf): upstream serverpool { server 1.2.3.101:80 weight=1; server 1.2.3.102:80 weight=1; } server { listen 80; server_name www.example.com checkout.example.com; location / { proxy_pass http://serverpool; } } 从两个Apache服务器的相同的 Vhost文件(httpd.conf): <VirtualHost *:80> ServerName www.example.com DocumentRoot /var/www/html/www.example.com/ </VirtualHost> <VirtualHost *:80> […]