代理错误 - 如何将 Nginx 配置转换为 Apache 配置?

代理错误 - 如何将 Nginx 配置转换为 Apache 配置?

我怎样才能将下面的 nginx 设置转换为 apache 的设置?

http {
    server {
        listen          8000;
        server_name     127.0.0.1;
        location / {
            proxy_pass http://unix:/run/gunicorn/socket;
        }
    }
}

这是我做的:

sudo nano /etc/apache2/sites-available/000-default.conf

<VirtualHost *:8000>
    ServerName localhost
    ProxyPass / http://unix:/run/gunicorn/socket/
</VirtualHost>

然后:

$ sudo a2enmod proxy_http

$ sudo systemctl restart apache2
$ systemctl status apache2
● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: active (running) since Fri 2017-05-19 22:10:40 BST; 3s ago
  Process: 15817 ExecStop=/usr/sbin/apachectl stop (code=exited, status=0/SUCCESS)
  Process: 15831 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
 Main PID: 15835 (apache2)
    Tasks: 6 (limit: 4915)
   CGroup: /system.slice/apache2.service
           ├─15835 /usr/sbin/apache2 -k start
           ├─15836 /usr/sbin/apache2 -k start
           ├─15837 /usr/sbin/apache2 -k start
           ├─15838 /usr/sbin/apache2 -k start
           ├─15839 /usr/sbin/apache2 -k start
           └─15840 /usr/sbin/apache2 -k start

May 19 22:10:40 lau-desktop systemd[1]: Starting The Apache HTTP Server...
May 19 22:10:40 lau-desktop systemd[1]: Started The Apache HTTP Server.

看起来没有任何错误。但是在我的浏览器中http://127.0.0.1:8000/

Proxy Error

The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /.

Reason: DNS lookup failure for: unix:

Apache/2.4.25 (Ubuntu) Server at 127.0.0.1 Port 8000

有任何想法吗?

相关内容