nginx:[emerg] /etc/nginx/sites-enabled/example.com:20 中的重复位置“/”

问题描述 投票:0回答:0

目标: 我想为本地 DNS 使用 Windows 服务器

遇到问题,我在这里和到处都看到并尝试了许多不同的建议,结果是一样的。我确信这很简单,但我不能指手画脚。

任何帮助将不胜感激。

我试过使用 proxy_pass、上游配置和解析器,但仍然是同样的错误。

https://www.nginx.com/blog/dns-service-discovery-nginx-plus/

nginx 解析器——dns

**Error**
nginx: [emerg] duplicate location "/" in /etc/nginx/sites-enabled/example.com:20
**Configuration:**
nginx/1.18.0 (Ubuntu)
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.2 LTS
Release:        22.04
Codename:       jammy

应用程序:Wordpress 6.2

反向代理配置


`server {
    listen 443 ssl;
    root /var/www/html/wordpress;
    index  index.php index.html index.htm;
    server_name  example.com;
    access_log /var/log/nginx/reverse-access.log;
    error_log /var/log/nginx/reverse-error.log;
    ssl_certificate /etc/ssl/ssl-bundle.crt;
    ssl_certificate_key /etc/ssl/mykey.comkey.key;
    ssl_stapling on;
    ssl_stapling_verify on;
    client_max_body_size 500M;


    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }

    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
        expires max;
        log_not_found off;
    }

    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    location ~ \.php$ {
         include snippets/fastcgi-php.conf;
         fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
         include fastcgi_params;
    }`

主机文件

cpadmin@3SWEB1:/etc$ cat hosts
127.0.0.1       localhost
127.0.1.1       3SWEB1

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

10.90.10.11 example.com #Windows DNS 服务器

Netstat -plnt

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      -
tcp6       0      0 :::80                   :::*                    LISTEN      -
tcp6       0      0 :::22                   :::*                    LISTEN      -
tcp6       0      0 ::1:631                 :::*                    LISTEN      -

试过这三种方案:

  1. nginx 解析器——dns

  2. https://www.nginx.com/blog/dns-service-discovery-nginx-plus/

  3. https://dev.to/ivishalgandhi/local-home-lab-dns-setup-with-dnsmasq-and-nginx-8b5

nginx-reverse-proxy
© www.soinside.com 2019 - 2024. All rights reserved.