NGINX Config 安装 WHMCS 时出现问题

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

我不知道应该在 Nginx 配置文件中写入什么来启动 WHMCS 安装。我已将下载的 WHMCS 文件夹放入 var/www/html 中,并将其重命名为 billing。我的配置文件如下。目前,当我运行 IP/billing/install 时(如突发奇想安装指南中所述),我会将一个文件下载到我的浏览器中。请帮忙。

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html;

    # Add index.php to the list if you are using PHP
    index index.html index.php index.htm index.nginx-debian.html;

    server_name _;

    #location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        #proxy_pass http://localhost:3000;
    
    #}

            # WHMCS CONFIG
        # When WHMCS updates, make sure to get the newest configuration at https://hostup.org/blog/whmcs-friendly-urls-configuration-for-nginx/

        location ~ /billing/announcements/?(.*)$ {
        rewrite ^/(.*)$ /billing/index.php?rp=/announcements/$1;
        }

        location ~ /billing/download/?(.*)$ {
        rewrite ^/(.*)$ /billing/index.php?rp=/download$1;
        }

        location ~ /billing/knowledgebase/?(.*)$ {
        rewrite ^/(.*)$ /billing/index.php?rp=/knowledgebase/$1;
        }

        location ~ /billing/store/ssl-certificates/?(.*)$ {
        rewrite ^/(.*)$ /billing/index.php?rp=/store/ssl-certificates/$1;
        }

        location ~ /billing/store/sitelock/?(.*)$ {
        rewrite ^/(.*)$ /billing/index.php?rp=/store/sitelock/$1;
        }

        location ~ /billing/store/website-builder/?(.*)$ {
        rewrite ^/(.*)$ /billing/index.php?rp=/store/website-builder/$1;
        }

        location ~ /billing/store/order/?(.*)$ {
        rewrite ^/(.*)$ /billing/index.php?rp=/store/order/$1;
        }

        location ~ /billing/cart/domain/renew/?(.*)$ {
        rewrite ^/(.*)$ /billing/index.php?rp=/cart/domain/renew$1;
        }

        location ~ /billing/account/paymentmethods/?(.*)$ {
        rewrite ^/(.*)$ /billing/index.php?rp=/account/paymentmethods$1;
        }

        location ~ /billing/password/reset/?(.*)$ {
        rewrite ^/(.*)$ /billing/index.php?rp=/password/reset/$1;
        }

        location ~ /billing/account/security/?(.*)$ {
        rewrite ^/(.*)$ /billing/index.php?rp=/account/security$1;
        }

        location ~ /billing/subscription?(.*)$ {
        rewrite ^/(.*)$ /billing/index.php?rp=/subscription$1;
        }

    #Social media authorization
        location ~ /billing/auth/provider/google_signin/finalize/?(.*)$ {
        rewrite ^/(.*)$ /billing/index.php?rp=auth/provider/google_signin/finalize$1;
        }

     #WHMCS ADMIN
    location ~ /billing/admin/(addons|apps|search|domains|help\/license|services|setup|utilities\/system\/php-compat)(.*) {
        rewrite ^/(.*)$ /billing/admin/index.php?rp=/admin/$1$2 last; 
        }

        location ~ /billing/admin/client/?(.*)/paymethods/?(.*)$ {
        rewrite ^/(.*)$ /billing/admin/index.php?rp=/client/?(.*)/paymethods/$1;
        }

        location ~ /billing/admin/setup/auth/?(.*)$ {
        rewrite ^/(.*)$ /billing/admin/index.php?rp=/setup/auth/$1;
        }

        location ~ /billing/admin/client/?(.*)/tickets/?(.*)$ {
        rewrite ^/(.*)$ /billing/admin/index.php?rp=/client/?(.*)/tickets/$1;
        }

        location ~ /billing/admin/client/?(.*)/invoice/?(.*)/capture/?(.*)$ {
        rewrite ^/(.*)$ /billing/admin/index.php?rp=/client/?(.*)/invoice/?(.*)/capture/$1;
        }

        location ~ /billing/admin/account/security/two-factor/?(.*)$ {
        rewrite ^/(.*)$ /billing/admin/index.php?rp=/admin/account/security/two-factor/$1;
        }

        location ~ /billing/admin/search/intellisearch?(.*)$ {
        rewrite ^/(.*)$ /billing/admin/index.php?rp=/search/intellisearch/$1;
        }

    # Security Advisory 2020-01-28
        location ^~ /vendor/ {
        deny all;
        return 403;
        }
    # END WHMCS CONFIG
}

php nginx nginx-config whmcs
1个回答
1
投票

这个问题发生在Nginx中

修复很简单

删除.htaccess文件
和 转到常规设置 然后向下滚动到友好 URL

制作友好的 URL 是基本的 url

就这样

它将所有网址转换为以 .php 结尾

所有 whmcs 网址都可以正常工作

或者你可以在虚拟主机文件中使用它,它会起作用

    error_page 404 /index.php?$query_string;
    try_files $uri $uri/ /index.php?$query_string;
  }

    # Custom rewrites for WHMCS paths
  location /announcements {
    try_files $uri $uri/ /index.php?rp=/announcements/$1;
  }

  location /download {
    try_files $uri $uri/ /index.php?rp=/download/$1;
  }

  location /knowledgebase {
    try_files $uri $uri/ /index.php?rp=/knowledgebase/$1;
  }

  location /store/ssl-certificates {
    try_files $uri $uri/ /index.php?rp=/store/ssl-certificates/$1;
  }

  location /store/sitelock {
    try_files $uri $uri/ /index.php?rp=/store/sitelock/$1;
  }

  location /store/website-builder {
    try_files $uri $uri/ /index.php?rp=/store/website-builder/$1;
  }

  location /store/order {
    try_files $uri $uri/ /index.php?rp=/store/order/$1;
  }

  location /hosting/cart/domain/renew {
    try_files $uri $uri/ /index.php?rp=/cart/domain/renew/$1;
  }

  location /account/paymentmethods {
    try_files $uri $uri/ /index.php?rp=/account/paymentmethods/$1;
  }

  location /password/reset {
    try_files $uri $uri/ /index.php?rp=/password/reset/$1;
  }

  location /account/security {
    try_files $uri $uri/ /index.php?rp=/account/security/$1;
  }

  location /subscription {
    try_files $uri $uri/ /index.php?rp=/subscription/$1;
  }

  location /auth/provider/google_signin/finalize {
    try_files $uri $uri/ /index.php?rp=auth/provider/google_signin/finalize/$1;
  }

  # WHMCS admin section rewrites
  location ~ /admin/(addons|apps|search|domains|help\/license|services|setup|utilities\/system\/php-compat) {
    try_files $uri $uri/ /admin/index.php?rp=/admin/$1 last;
  }

  location ~ /admin/client/(.*)/paymethods {
    try_files $uri $uri/ /admin/index.php?rp=/client/$1/paymethods;
  }

  location ~ /admin/setup/auth {
    try_files $uri $uri/ /admin/index.php?rp=/setup/auth;
  }

  location ~ /admin/client/(.*)/tickets {
    try_files $uri $uri/ /admin/index.php?rp=/client/$1/tickets;
  }

  location ~ /admin/client/(.*)/invoice/(.*)/capture {
    try_files $uri $uri/ /admin/index.php?rp=/client/$1/invoice/$2/capture;
  }

  location ~ /admin/account/security/two-factor {
    try_files $uri $uri/ /admin/index.php?rp=/admin/account/security/two-factor;
  }

  location ~ /admin/search/intellisearch {
    try_files $uri $uri/ /admin/index.php?rp=/search/intellisearch;
  }


  location ^~ /vendor/ {
    deny all;
    return 403;
  }

wppit

© www.soinside.com 2019 - 2024. All rights reserved.