小编hel*_*y77的帖子

使 Nginx 遵循符号链接

Nginx 不遵循符号链接。我收到 404 错误。在我的目录中,我有这个链接:

lrwxrwxrwx  1 root root    48 Sep 23 08:52 modules -> /path/to/dir/
Run Code Online (Sandbox Code Playgroud)

但是/path/to/dir找不到存储在其中的文件。

symlink nginx

37
推荐指数
2
解决办法
9万
查看次数

代理 (nginx) 显示错误网关错误

我有一个在 上运行的服务(docker 注册表)port 5000,我已经安装了 nginx 以将 http 请求从 重定向80805000。如果我卷曲localhost:5000它可以工作,但是当我卷曲它时,localhost:8080我会收到一个错误的网关错误。

nginx配置文件:

upstream docker-registry {
 server localhost:5000;
}

server {
 listen 8080;
 server_name registry.mydomain.com;

 proxy_set_header Host       $http_host; 
 proxy_set_header X-Real-IP  $remote_addr; 
 client_max_body_size 0; 
 chunked_transfer_encoding on;

 location / {

     proxy_pass http://docker-registry;
 }
 location /_ping {
     auth_basic off;
     proxy_pass http://docker-registry;
 }
 location /v1/_ping {
     auth_basic off;
     proxy_pass http://docker-registry;
 }

}
Run Code Online (Sandbox Code Playgroud)

/var/log/nginx/error.log我有:

[crit] 15595#0: *1 connect() to [::1]:5000 failed (13: Permission denied) …
Run Code Online (Sandbox Code Playgroud)

proxy nginx gateway

18
推荐指数
2
解决办法
6万
查看次数

通过减少 /home 增加根分区

嗨,我需要通过减少 /home 来增加根分区空间,在 Centos 6.6 中,我的情况是这样的:

/dev/mapper/VolGroup-lv_root      50G   46G  1,6G  97% / 
tmpfs                            1,9G     0  1,9G   0% /dev/shm 
/dev/sda1                        477M   61M  391M  14% /boot 
/dev/mapper/VolGroup-lv_home     140G  3,9G  129G   3% /home
Run Code Online (Sandbox Code Playgroud)

是否可以?

partition lvm resize2fs

17
推荐指数
2
解决办法
6万
查看次数

如何配置 HAproxy 以重定向多个域

我需要配置 HAproxy 以使用 SSL 重定向多个域,我需要以这种方式重定向:

www.foo.com redirect to ip_other_webserver:81
www.bar.com redirect to ip_other_webserver:82
www.zoo.com redirect to ip_other_webserver:8080
Run Code Online (Sandbox Code Playgroud)

我不知道 HAproxy,过去我用 nginx 做了相同的配置,但我也需要负载均衡器。我找不到配置示例。谢谢

http-proxy proxy

7
推荐指数
1
解决办法
2万
查看次数

运行时错误:您需要安装 gevent 才能使用此工作线程

我需要 gevent 来运行 docker-registry 但我有这个错误:

Error: class uri 'gevent' invalid or not found: 

[Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/util.py", line 139, in load_class
    mod = import_module('.'.join(components))
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/ggevent.py", line 22, in <module>
    raise RuntimeError("You need gevent installed to use this worker.")
RuntimeError: You need gevent installed to use this worker.
]
Run Code Online (Sandbox Code Playgroud)

我试图与安装GEVENTapt-getpip,但运行命令时,始终这个错误

更新:

Debian 7.8 64 位

输出 dpkg -l | grep python

ii  libpython2.6                       2.6.8-1.1                     amd64        Shared …
Run Code Online (Sandbox Code Playgroud)

python

5
推荐指数
1
解决办法
1万
查看次数

AddDefaultCharset ISO-8859-1 不起作用

我已将 Apache 从 2.2 升级到 2.4,但遇到字符编码问题。在我的页面中,我有è=è ò=ò ì=ì等...

在我的httpd.conf我已经评论了默认值并添加了ISO-8859-1(西欧)

#AddDefaultCharset UTF-8
AddDefaultCharset ISO-8859-1
Run Code Online (Sandbox Code Playgroud)

但这并没有改变任何事情。

character-encoding apache-httpd

3
推荐指数
1
解决办法
3万
查看次数

如何为 http 和 https 请求设置 Nginx

我需要设置 Nginx 以便它响应 http 和 https 请求;我以这种方式配置了我的默认配置:

server {
  listen       80;
  listen       443;
  ssl           on;
  ssl_certificate       /etc/nginx/certs/domain-bundle.crt;
  ssl_certificate_key   /etc/nginx/certs/domain.it.key;
  server_name  static.domain.it;
  location / {
    try_files $uri @s3cache;
  }

  location @s3cache{
    proxy_cache            S3CACHE;
    proxy_cache_valid      200 48h;
    proxy_cache_valid      403 60m;
    proxy_pass http://static.domain.it.s3-external-3.amazonaws.com;
  }
}
Run Code Online (Sandbox Code Playgroud)

https 协议工作正常,但如果我发出 http 请求,则会收到此错误:

400 Bad Request
The plain HTTP request was sent to HTTPS port
Run Code Online (Sandbox Code Playgroud)

configuration nginx

3
推荐指数
1
解决办法
9374
查看次数

Apache 2.4 基本身份验证不起作用

我在 apache 2.4 中的基本身份验证有问题。我有这些行:

<VirtualHost *:80>
    ServerAdmin email@email.com
    DocumentRoot /var/www/html/foo
    ServerName my.domain.com

<Directory /var/www/html/foo/>
        Options FollowSymLinks
        Require all granted
        DirectoryIndex index.php
        AuthType Basic
        AuthName "Authentication Required"
        AuthUserFile "/etc/httpd/.htpasswd"
        Require valid-user
</Directory>

</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

身份验证被绕过并在没有密码请求的情况下显示站点。

authentication apache-httpd

3
推荐指数
1
解决办法
5145
查看次数

NGINX:400 纯 HTTP 请求已发送到 HTTPS 端口

我将 nginx 设置为 docker 注册表的 proxypass,协议 http 有效,但如果我设置了 https,我有: 400 The plain HTTP request was sent to HTTPS port

这是我的 nginx 配置文件:

upstream docker-registry {
 server 127.0.0.1:5000;
}

server {
 listen 443 ssl;
 server_name docker-registry.mydomain.it;

  ssl_certificate /etc/ssl/certs/docker-registry;
  ssl_certificate_key /etc/ssl/private/docker-registry;

 proxy_set_header Host       $http_host;   # required for Docker client sake
 proxy_set_header X-Real-IP  $remote_addr; # pass on real client IP

 client_max_body_size 0; # disable any limits to avoid HTTP 413 for large image uploads

 # required to avoid HTTP 411: see Issue #1486 …
Run Code Online (Sandbox Code Playgroud)

ssl nginx

2
推荐指数
1
解决办法
8390
查看次数