如何将 Nginx 位置重写转换为 Apache

如何将 Nginx 位置重写转换为 Apache

我有一个使用 nginx 运行的网站,但现在是 apache。我试图将 nginx 转换为 apache,但没有成功

这是我想要转换为 apache 的 nginx 文件:

server {
    listen                      80;
    listen                      443 ssl http2;
    include                     ssl.conf;
    include                     upload2.conf;
    ssl_certificate             /srv/config/ssl/wrx.org-combined.crt;
    ssl_certificate_key         /srv/config/ssl/wrx.org.key;
    ssl_trusted_certificate     /srv/config/ssl/_bundle_digicert_ev.crt;

    server_name                 wrx
                                wrx.*
                                .wrx.org;
    root                        /srv/sites/wrx/web;

    if ($http_host = www.wrx.org) {
        rewrite ^              $scheme://wrx.org$request_uri permanent;
    }

    include                     debug.conf;
    include                     robots.conf;

    location /api {
        try_files               $uri @api;
    }

    location /give {
        try_files               $uri @api;
    }

    location /forgot {
        try_files               $uri @api;
    }

    location / {
        set $script_name        /index.php;
        try_files               $uri $uri.html $uri/index.html @php;
        location ~* \.(?>js|css|svg|png|jpg|jpeg|gif|mp4|mov|m4v|ico|woff2?|ttf|eot)$ {
            # Directives to send expires headers and turn off 404 error logging.
            expires             30d;
            log_not_found       off;
            try_files           $uri @api;
        }
    }

    location ^~ /media/videos {
        expires                 30d;
        more_set_headers        "Content-Type: video/mp4";
    }

    # Do not allow .php to be used in the URL (/chat will allow it)
    location ~ \.php$ {
        internal;
        return 404;
    }

    # Node.js API
    location @api {
        proxy_pass              http://appwrx;
        proxy_cache             off;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        Host $http_host;
    }

    # CI main/dashboard
    location @php {
        # If $uri.php is a valid PHP file, we use that
        if (-e $request_filename.php) {
            set $script_name    $uri.php;
        }
        include                 php.conf;
        fastcgi_cache           off;
        fastcgi_pass            $php_upstream;
    }
}

我尝试过使用代理传递和 RewriteBase,但似乎没有任何效果这是我的 Apache 文件,这是我目前所知道的全部内容:

 Include /etc/phpmyadmin/apache.conf

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html
        RewriteEngine on

        ErrorLog ${APACHE_LOG_DIR}/error.log

        CustomLog ${APACHE_LOG_DIR}/access.log combined

         <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>


        ProxyPass /api http://localhost:8010/api
        ProxyPassReverse /api http://localhost:8010/api


</VirtualHost>

相关内容