目前我正在使用nginx-proxy将我的子域路由到不同的docker容器。 现在,我想添加一个SSL证书到我的个人云容器,但我没有正确设置它。 我做了什么: 通过certbot获得证书 我尝试通过执行./certbot-auto certonly获得SAN证书,我已经进入了每个我想要使用的子域。 证书已成功生成到etc/letsencrypt/live/www.mydomain.com 将证书挂载到owncloud容器并设置nginx-proxy 快速看看我的docker-compose.yml: nginx-proxy: image: jwilder/nginx-proxy ports: – "80:80" – "443:443" volumes: – /var/run/docker.sock:/tmp/docker.sock owncloud: image: owncloud expose: – 80 – 443 environment: – "VIRTUAL_HOST=owncloud.mydomain.com,www.owncloud.mydomain.com" – "VIRTUAL_PROTO=https" – "VIRTUAL_PORT=443" volumes: – "owncloud-data:/var/www/html" – "/etc/letsencrypt/live/www.mydomain.com:/root/ssl" 这里是我的/etc/apache2/sites-available/default-ssl.conf的摘录(当然是从自己云端容器的一个) <IfModule mod_ssl.c> <VirtualHost _default_:443> ServerAdmin webmaster@localhost DocumentRoot /var/www/html ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined SSLEngine […]
我需要configurationnginx服务器,他显示403页,如果URL包含两个点(..)在URL的任何地方。 例如,如果URL是“site.sit / index.php?log = .. / conf.php – web服务器应该检测到上面的目录并带上403-messege。我试图在conf – 文件nginx在那里: location \.\. { deny all; } 但是这不行。 告诉我,我该如何执行这个计划?
全新安装CentOS 7和nginx 1.6.3。 根据官方文档,我将access_log指令设置为通过syslog转发到/etc/nginx/nginx.conf中的远程服务器: #access_log /var/log/nginx/access.log main; access_log syslog:server=[10.1.2.3],facility=local7,tag=nginx,severity=info; 当我重新启动(或启动)nginx与该更改,我得到以下错误: [root@localhost ~]# systemctl restart nginx Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details. [root@localhost ~]# systemctl status nginx.service (…) nginx: [emerg] open() "/usr/share/nginx/syslog:server=[10.1.2.3],facility=local7,tag=nginx,severity=info" failed (13: Permission denied) (…) 这就像服务不知道如何正确parsing自己的configuration文件,就好像IP和选项是它试图读取的文件的一部分一样。 任何人得到这个工作,我错过了明显的东西?
我正在运行一个nginx / php5.6-fpm服务器,我有以下几点 server { listen 10080; listen [::]:10080; root /home/vagrant/app; index index.php; server_name mia-dev.dev; port_in_redirect on; rewrite ^/static/(.*)$ /dist/static/$1 permanent; location / { try_files $uri $uri/ /index.php?$query_string; } # load the index page on 404 error_page 404 /index.php; # don't log requests to favicon.ico location = /favicon.ico { log_not_found off; access_log off; } # […]
使用类似try_files东西我怎样才能检查多个目录来查看文件是否存在? 如果文件存在redirect到该位置,如果不显示404。 旧文件夹^/wp-content/uploads(/.*)?$ 多个文件夹来检查 /sites/default/files$1; /sites/default/files/testA$1; /sites/default/files/testB$1; /sites/default/files/testC$1; /sites/default/files/testD$1; 例如:如果文件存在于/sites/default/files/testB$1; 然后将^/wp-content/uploads(/.*)?$到该位置
我试图设置一个nginx重写规则,但无法弄清楚如何让它工作。 我想将所有urlhttps://domainname.com/archives/year/month/date/postnameredirect到https://domainname.com/postname 页面https://domainname.com/archives需要保持活跃。 谁能帮助我? 欢呼声,夏普
大家好,问候。 首先感谢您抽出宝贵的时间来回顾并回答我的问题。 非常感谢。 或多或less,我正在使用新的虚拟机(Google Cloud Computing)设置所有设置,并尝试使用Debian,nginx,mariadb,php。 我已经在虚拟机上多次尝试过这种types的设置,但是这次我决定在使用apt-get的时候得到最新版本的nginx(1.10.1)而不是Debian的默认软件包安装nginx而不更新源列表。 (我相信一个就像1.6.3)。 虽然两者之间的差异是最小的,但我注意到的一件事是这个版本的nginx不使用服务器块(Vhosts)的/ sites-enabled /和/ sites-available /文件夹,它直接进入/ etc / nginx / conf.d /文件夹。 没问题,我想。 现在我的情况是我正在工作的网站organiplan点com显示404页面没有find,尽pipe它似乎像我的服务器块和nginx.conf文件安装正确。 我将在下面包括。 服务器块 server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /var/www/html/organiplan.com/public_html; index index.php index.html index.htm; server_name organiplan.com www.organiplan.com; client_max_body_size 1024m; location / { try_files $uri $uri/ /index.php?q=$request_uri; } error_page 404 /404.html; error_page […]
我正在查看Chrome开发工具中的日志。 我也可以看到它使用curl。 这是curl的输出 Content-Type: application/javascript Date: Sat, 24 Sep 2016 01:16:37 GMT ETag: "a02d00a09b8139b0919567e4c92cc752" Last-Modified: Fri, 23 Sep 2016 22:57:56 GMT Server: nginx x-amz-id-2: L3gfIQNLcBLUZ2gtVWDiIdN9xWWiV2H6K6zjjE9JSHVMnDXI6+uLuhqptqQRCZLNFoMmWg3mIQs= x-amz-request-id: E38062B3D506DF06 Content-Length: 1940494 Age: 7574 Warning: 110 squid/3.5.20 "Response is stale" X-Cache: HIT from 0.0.0.0 X-Cache-Lookup: HIT from 0.0.0.0:3128 Via: 1.1 0.0.0.0 (squid/3.5.20) Connection: keep-alive 为什么鱿鱼说Warning: 110 squid/3.5.20 "Response […]
我试图做一些在我看来非常简单的事情,但是我一定是愚蠢的或者错过了一些非常明显的事情,因为我无法弄清楚。 我想访问运行在我的服务器上的多个Web应用程序,每个应用程序都有一个唯一的前缀: http://mywebserver/app1 -> localhost:9001 http://mywebserver/app2 -> localhost:9002 … 根据我的理解,我需要将Nginxconfiguration为反向代理,所以我这样做了: server { listen 80; server_name mywebserver; location /app1{ proxy_set_header Host $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_pass http://127.0.0.1:9001/; } … } 这个configuration允许我通过http://mywebserver/app1访问应用程序的主页,但是没有加载静态内容。 当我打开我的浏览器的控制台时,我可以看到它试图从http://mywebserver/static/custom/index.js获取资源,而不是像http://mywebserver/app1/static/custom/index.js 。 我试图在位置块中添加一个root指令来提供静态,但是由于静态内容请求是在/而不是在/app1上进行的,所以它不被考虑。 如何解决这个问题? 是否有什么明显的我失踪或我完全误解了反向代理的概念? 谢谢。
我一直在这个工作了几个小时,仍然无法看到我的configuration有什么问题。 请看下面。 在/ etc / nginx的/启用的站点- /默认 server { listen 80; server_name example.com www.example.com; return 301 https://www.example.com$request_uri; } server { listen 443 ssl; server_name example.com www.example.com; ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; ssl_ciphers 'ECDHE-RSA-AES128…; location / { include uwsgi_params; uwsgi_pass unix:/my_socket/site.sock; } location /static/ { alias /my_static/location/; } location /media { […]