我有一个nginx的问题。 如果你打电话给“example.com”或者“example.example.com”,nginx会像我想要的那样将它redirect到“www.example.com”。 但是,如果我input如下所示的URI,则不会redirect:“example.com/doesnt-redirect”。 它不会添加“www”。 部分,因此,我从我的博客网站获得404。 我的configuration是: server { listen 80; server_name www.example.com *.example.com; if ($http_host != "www.example.com") { return 301 http://www.example.com$request_uri; } root /home/ghost/; index index.html; }
在我们的老服务器(托pipe)上,Artifactory运行在Apache代理之后。 公开的url是http://repo.example.com/ 我们的托pipe服务提供商把我们搬到了新的服 安装了新版本的Artifactory,从旧服务器导出数据并导入到新服务器中 Artifactory现在运行在Nginx之后 公开的url现在是http://repo.example.com/artifactory/ 我们要求我们的托pipe服务提供商将url更改回http://repo.example.com/ ,因为现在我们的Jenkins工作正在中断,而外部用户可能依赖于该url。 他们告诉我,我首先需要改变Artifactory中的一些设置(没有详细说明),但是我可以在Web界面中find的唯一设置是自定义url库,并且已经设置为http:// repo。 example.com 。 我最好的猜测是在运行Artifactory的Tomcat服务器的configuration中需要改变某些东西 Tomcat的configuration不在我的专业领域 我无法自己更改configuration,我没有对这些文件的写入权限。 我真正需要的是一个configuration,我可以发送到我们的托pipe服务提供商,所以他们可以从我的电子邮件复制粘贴。 短版本: 如何在http://repo.example.com上访问运行在Nginx后面的Artifactory? 编辑:这是当前的/usr/local/artifactory/tomcat/conf/server.xml : <Server port="8015" shutdown="SHUTDOWN"> <Service name="Catalina"> <Connector port="8083"/> <Engine name="Catalina" defaultHost="localhost"> <Host name="localhost" appBase="webapps"/> </Engine> </Service> </Server> 将它改为: <Server port="8015" shutdown="SHUTDOWN"> <Service name="Catalina"> <Connector port="8083"/> <Engine name="Catalina" defaultHost="localhost"> <Host name="localhost" appBase="webapps"> <Context path="" docBase="."/> </Host> </Engine> […]
我正在使用CentOS,NGINX和Passenger来服务Rails应用程序。 我有SELinux激活,并有一系列与logrotate的问题。 我已经能够通过在线提供各种build议来解决大部分问题。 不幸的是,logrotate没有成功的旋转我的NGINX日志文件。 NGINX安装在/ opt / nginx中 这是我的logrotateconfiguration文件: /opt/nginx/logs/*log { daily rotate 30 missingok notifempty sharedscripts delaycompress postrotate [ ! -f /opt/nginx/logs/nginx.pid ] || kill -USR1 `cat /opt/nginx/logs/nginx.pid` endscript } 这些是我在/ var / log / messages中收到的消息 Mar 9 03:49:14 localhost setroubleshoot: SELinux is preventing /usr/sbin/logrotate from rename access on the file logrotate_temp.RTg4y3. For complete […]
下面列出了我们正在考虑的3个选项。 哪一个最好,还是有更好的解决办法,我们没有考虑。 所有的服务器都是nginx的linux。 你有没有看到任何一个特别错误? 额外的澄清。 nginx的php-fpm服务器将有开放的端口到SQL服务器和文件共享,因此中间防火墙。 此外,可能需要对video进行转码,以便反向代理服务器将负载均衡nginx php-fpm服务器的实例。 1)互联网 – >防火墙 – >在DMZ中的nginx反向代理 – > firewall – > nginx php-fpm – > files&sql server 2)互联网 – >防火墙 – >在DMZ中的nginx php-fpm – > firewall – > files&sql server 3)互联网 – >防火墙 – >在DMZ中的nginx反向代理 – > firewall – > nginx php-fpm – > vm firewall – > […]
发送大容量date到我的服务器时,我的POST请求上得到414(请求 – URI太大)exception。 是否有可能增加POST数据的限制? 我已经做了nginxconfiguration下面的变化 large_client_header_buffers 8 2024k; 但它不起作用。
我正试图通过Nginx和uWSGI部署一个Django项目。 如果我运行该项目手动运行python manage.py runserver :8000它工作正常,所以项目本身不是我猜的问题。 我在一个专用的virtualenv中安装了Django和依赖关系,并把这个项目放在里面。我还在virtualenv的外面安装了nginx和uwsgi,并开始创buildconfiguration文件: /etc/nginx/sites-available/myproject (在启用了网站的系统中进行符号链接): upstream uwsgi_myproject { server 127.0.0.1:5678; } server { listen 80; server_name my.url.net; set $home /path/to/myvirtualenv; access_log /path/to/myvirtualenv/log/access_uwsgi.log; error_log /path/to/myvirtualenv/log/error_uwsgi.log; client_max_body_size 10m; keepalive_timeout 120; location / { uwsgi_pass uwsgi_myproject; include uwsgi_params; gzip on; uwsgi_param UWSGI_CHDIR $home/path/to/myproject; uwsgi_param UWSGI_SCRIPT uwsgi; uwsgi_param UWSGI_PYHOME $home; root $home; } location /static/ { […]
我设置我的nginx静态内容域如下所示: # static0.mywebsite.com static1.mywebsite.com static2.mywebsite.com static3.mywebsite.com server { # upload limit # upload_limit_rate 10240; # request size limitation client_max_body_size 500m; client_body_buffer_size 64k; # document root root /home/mywebsite/myns-projects/mywebsite_com/static/public/; # index file index index.php; # server name server_name static0.mywebsite.com; # rewrite rules rewrite "^/thumbnail/([A-Za-z0-9]{12})/(.*)/.*$" /index.php?request=thumbnail&unique=$1¶meters=$2 last; # set myns no cache set $myns_no_cache 1; if ($request_uri ~* […]
我有一些关于我在Ubuntu(14.10)的Gunicorn(19.0-1)和Nginx中部署Flask应用程序的基本问题。 由于这个应用程序与Web2Py一起,我遵循了一个指南来lockingWeb2Py生成的网站,并为我的Flask应用程序应用相同的策略。 在这个例子中,Gunicorn工作人员作为www-data用户运行,并且通过将www-data组作为拥有者和www-data组locking在/ var / www中的文件和源文件。 但是,有几点让我困惑: 尽pipeGunicorn工作人员以www数据运行,但Gunicorn服务器守护程序仍以root身份运行。 这会引起担忧吗? searchNginx + Gunicorn + Flask会导致推荐通过supervisord运行Gunicorn的站点,而不是init.d服务。 我应该考虑转换吗? 由于www数据帐户被locking(无shell /无密码),开发人员在哪里使用虚拟机运行其代码,以使环境与生产尽可能接近?
在请求限制configuration之前,我有一些“拒绝”规则。 如果被阻止的用户(通过拒绝规则)是站起来的话,他仍然触发请求限制,因此创build数千个日志条目。 为什么? 我预料它不会超越否认规则。 include /etc/nginx/blacklist.conf; limit_req zone=limit burst=3 nodelay; 该日志显示一个禁止的错误,并在数百个请求限制错误之后。 这一遍又一遍地重复。
问题在于:(我是NGinx的新手,请仔细阅读,但没有find我的工作解决scheme。) 我在Windows系统上。 我的项目文件系统位于: E:/www/ 这里是一个项目文件夹,我将尝试在本例中稍后介绍: E:/www/projectTest 我有一个Apache服务器运行良好。 我想build立一个Nginx服务器并行,这就是为什么我使用另一个端口configuration我的nginx(见下面的configuration文件)。 Nginx的文件在那里: E:/nginx/ 我在那里复制了一个PHP: E:/nginx/php/ 这里是我的例子'index.php'我放在我目前的文件夹来testing我的php和nginxconfiguration: <?php echo "THIS IS A TEST"; ?> 这里是我的nginx.conf文件(我删除了注释行): worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 8111; server_name localhost; root E:/nginx/; index index.php index.html index.htm; charset utf-8; location / { […]