我试图安装我的第一个LEMP堆栈,经过了很多小时的阅读,它工作得很好(该死的,www-data组的写权限问题是一个艰难的问题)。 无论如何,我的Joomla网站现在工作和performance比以往更好,但我注意到一个奇怪的问题,漂亮的url: 如果我访问www.mysite.com/index.php/some/content/alias/一切都很好。 但是,如果我访问www.mysite.com/index.phpsome/content/alias/ (注意index.php之后缺less斜线)也是可以的。 这是预期的行为? 我知道最终用户不会访问那些,但它的存在正在驱使我疯狂,因为它应该扔404,对吧? 这是我的configuration: server { listen 80; server_name domain.bla; return 301 http://www.domain.bla$request_uri; } server { listen 80; server_name www.domain.bla; root /home/domain/public_html; index index.php index.html index.html; #Specify a charset charset utf-8; # Custom 404 page error_page 404 /404.html; # Include the basic h5bp config set # The error remains if I […]
我已经审查/尝试以前在网上发现的build议无济于事。 我目前在我的Nginx反向代理之前有一个ELB设置,然后将stream量传递到3个不同的ELB上,这些ELB位于3个不同的Web应用(运行在EC2上)之前。 我需要确保来到第一个ELB + Rev Proxy的stream量始终是SSL。 rev代理然后根据路线路由到各种应用程序。 这是我的nginx / sites-available / example.conf文件的片段: server { listen 80; server_name staging.example.com; return 301 https://staging.example.com$request_uri; } server { listen 443 ssl; server_name staging.example.com; ssl_certificate /location ssl_certificate_key /location location /app1 { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; proxy_pass http://ELB } } 当使用上面的内容,并尝试在网上发现的先前信息,一旦实施,第一个ELB将停止工作。 如果我直接转到代理服务器stream量没有通过,但页面不会出错,它只是空白。 问题:1.假设我上面的rev代理设置是正确的,一旦stream量变为https并进入ELB / Rev Proxy,它是否继续通过https连接到其他ELB? […]
我最近把我的CentOS 7机器上的Web服务器从Apache切换到了Nginx。 最初,我已经将我的用户帐户添加到apache组,然后做了一个recursionchown ,使公共web根中的所有文件属于用户和组apache 。 有了这个,我能够成功地编辑文件作为我自己的用户没有root权限。 但是,反过来在nginx中不起作用。 我将我的用户帐户添加到nginx组(如nginx.conf文件中指定的那样),我无法编辑现有的文件,添加新的文件或目录或任何types的东西。 唯一的解决方法是将我的用户添加为公共Web根的所有者。 理想情况下,我宁愿将nginx作为用户和组,并让我的用户帐户能够以这种方式访问文件。 是否有一个原因,我不能编辑由nginx用户和组拥有的文件,尽pipe我的用户帐户属于nginx组? 我很困惑如何进一步debugging。 谢谢。
我正在处理的Magento应用程序中遇到403&404错误,我在NGINXconfiguration中将这个问题追查到了两个块,如果我将它们解决了,问题就解决了,但是我想更好地理解我正在评论的内容。 问题1 我在url上遇到了403错误,例如 http://www.example.com/media/wysiwyg/.thumbs/wysiwyg/banner.jpg 我猜这是由于下面的代码块&当然,当我评论它的工作! # Deny all attempts to access hidden files # such as .htaccess, .htpasswd, etc… location ~ /\. { deny all; access_log off; log_not_found off; } 现在的问题是我的.gitignore文件现在可以访问。 我怎样才能更好地重写这个块? 什么~ /\. 意思? 问题2 我在url上遇到了404错误,例如: http://www.example.com/js/gene/braintree/braintree-0.1.js 我发现,如果我改变了这个文件的名字braintree-0.1.min.js我停止了对它的404错误,当我从NGINX删除下面的块,它的原始名称加载罚款, braintree-0.1.js所以它必须与文件名后面的点有关。 ## # Rewrite for versioned CSS+JS via filemtime ## location ~* ^.+\.(css|js)$ { rewrite ^(.+)\.(\d+)\.(css|js)$ […]
我读过ngx_http_core_module#variables ,但是我找不到Accept-Encoding字段。
我决定尝试nginx,但似乎我被困在真正的开始。 我有一台运行Debian的服务器,我试图configuration1个域名+2个子域名的nginx。 当我访问主域时,它显示了它应该是什么。 当我访问第一个子域时,它访问正确的文件夹,但是当我访问第二个子域时,它会显示主域。 这是我迄今为止修改的内容: 网站 – 可用(主域) 工作正常 server { listen 80 default_server; listen [::]:80 default_server; root /var/www/domain.com/public_html/; index index.php index.html index.htm index.nginx-debian.html; server_name www.domain.com domain.com; location / { try_files $uri $uri/ =404; } } 网站可用(第一个子域) 工作正常 server{ listen 80; listen [::]:80; root /var/www/sub1.domain.com; index index.php index.html index.htm index.nginx-debian.html; server_name sub1.domain.com; location / { […]
我有一个nginxconfiguration设置,并在/etc/nginx/sites-available/default-staging 。 今天我已经尝试添加另一个基于这种configuration的邮件营销应用程序。 在运行service nginx restart命令失败后,我在网上查了一下,发现nginx -c /etc/nginx/sites-available/sendy-newsletter -t应该突出显示任何sytax错误,它给出了以下结果。 nginx: [emerg] "server" directive is not allowed here in /etc/nginx/sites-available/sendy-newsletter:1 nginx: configuration file /etc/nginx/sites-available/sendy-newsletter test failed 有两件事让我困惑,首先,我不明白为什么服务器块将不被允许,在网上检查后,似乎这可能会导致如果sites-enabledconfiguration文件不包括在我的nginx.conf的hhtp块nginx.conf ,但他们是: user www-data; worker_processes auto; pid /run/nginx.pid; events { worker_connections 2048; multi_accept on; use epoll; } http { ## # Basic Settings ## sendfile on; tcp_nopush on; tcp_nodelay on; […]
我有一个生产服务器,我已经做了一个重要的项目更新,所以我决定部署新的更新到一个单独的服务器,以testing它在同一个生产服务器上的另一个端口上,但它没有工作.. 我试图设置端口9090指向我的testing服务器,但后来我得到: http://example.com:9090/ This webpage is not available 任何想法? 这是我的块: testing服务器: server { listen 9090; server_name tree; root /home/forge/tree/public; # FORGE SSL (DO NOT REMOVE!) # ssl_certificate; # ssl_certificate_key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; index index.html index.htm index.php; charset utf-8; location / { try_files $uri $uri/ /index.php?$query_string; } location = /favicon.ico { access_log off; log_not_found off; […]
在我转到https://sub.mydomain.com时,我的nginx.conf有以下内容,这对于HTTPS非常nginx.conf 。 我需要也允许HTTP (因此听80)。 server { listen 80; listen 443 ssl; server_name *.mydomain.io; ssl_certificate /etc/ssl/mydomain.crt; ssl_certificate_key /etc/ssl/mydomain.key; ssl on; ssl_session_cache builtin:1000 shared:SSL:10m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4; ssl_prefer_server_ciphers on; include /etc/nginx/sites-enabled/*; } 出于某种原因,当我尝试击中http://sub.mydomain.com它仍然将我redirect到https 。 我错过了什么吗?
我有一个服务运行在localhost:5001 ,我想让它从外部默认端口访问。 为此,我已经将以下configuration文件添加到nginxconfiguration文件夹的sites-avaiable文件夹中: server { listen 80; location / { if (-f /var/www-data/hq/downtime) { return 503; } proxy_pass http://127.0.0.1:5001/; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } error_page 502 503 504 @maintenance; location @maintenance { # In this example, there's a directory in the site media files # called "downtime" that […]