rewrite configuration

Discussion in 'Nginx' started by mayazir, Mar 10, 2024.

  1. #1
    Hi,
    My server worked ok with Apache, but my hoster is a bastard, they ruined my Apache and couldn't fix it, so they changed it to Nginx.
    Avoid axarnet.es - they charged me for 1 year and refused any help.
    Since then my .htaccess file doesn't work, but they refuse to help me move all htaccess configurations to Ngnix.
    My sitemap setting page shows me this:

    --------------------------------------------------------------
    Webserver Configuration
    Since you are using Nginx as your web server, please configure the following rewrite rules in case you get 404 Not Found errors for your sitemap:

    rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.xml$ "/index.php?xml_sitemap=params=$2" last;
    rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.xml\.gz$ "/index.php?xml_sitemap=params=$2;zip=true" last;
    rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.html$ "/index.php?xml_sitemap=params=$2;html=true" last;
    rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.html.gz$ "/index.php?xml_sitemap=params=$2;html=true;zip=true" last;

    ------------------------------------------------------------------

    On the Plesk config page, I see this:

    Additional nginx directives
    Here you can specify the nginx server settings as Apache reverse proxy. The settings you configure will override the configuration of the entire Nginx server. For example, if you want to change the connection timeout or compress requests with gzip. Use the same syntax as used for nginx.conf. For example, if you want to gzip all authorized requests, add the line: 'gzip_proxied any;'.


    Additional nginx directives:

    # Gzip
    gzip on;
    gzip_disable "msie6";

    gzip_comp_level 6;
    gzip_min_length 1100;
    gzip_buffers 16 8k;
    gzip_proxied any;
    gzip_types
    text/plain
    text/css
    text/js
    text/xml
    text/javascript
    application/javascript
    application/x-javascript
    application/json
    application/xml
    application/rss+xml
    image/svg+xml;

    if (!-e $request_filename) {
    set $test P;
    }
    if ($uri !~ ^/(plesk-stat|webstat|webstat-ssl|ftpstat|anon_ftpstat|awstats-icon|internal-nginx-static-location)) {
    set $test "${test}C";
    }
    if ($test = PC) {
    rewrite ^/(.*)$ /index.php?$1;
    }

    location ~* .(js|jpg|jpeg|gif|png|css|tgz|gz|rar|bz2|doc|pdf|ppt|tar|wav|bmp|rtf|swf|ico|flv|txt|woff|woff2|svg)$ {
    etag on;
    if_modified_since exact;
    add_header Pragma "public";
    add_header Cache-Control "max-age=31536000, public";
    }

    rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.xml$ "/index.php?xml_sitemap=params=$2" last;
    rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.xml\.gz$ "/index.php?xml_sitemap=params=$2;zip=true" last;
    rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.html$ "/index.php?xml_sitemap=params=$2;html=true" last;
    rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.html.gz$ "/index.php?xml_sitemap=params=$2;html=true;zip=true" last;

    ------------------------------------------------------------------------

    How can I check if everything is ok and what my sitemap plugin still show me this error:

    Webserver Configuration
    Since you are using Nginx as your web server, please configure the following rewrite rules in case you get 404 Not Found errors for

    your sitemap: rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.xml$ "/index.php?xml_sitemap=params=$2" last;
    rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.xml\.gz$ "/index.php?xml_sitemap=params=$2;zip=true" last;
    rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.html$ "/index.php?xml_sitemap=params=$2;html=true" last;
    rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.html.gz$ "/index.php?xml_sitemap=params=$2;html=true;zip=true" last;



     
    Last edited: Mar 10, 2024
    mayazir, Mar 10, 2024 IP
  2. GreenHost.Cloud

    GreenHost.Cloud Active Member

    Messages:
    471
    Likes Received:
    34
    Best Answers:
    3
    Trophy Points:
    73
    #2
    To check if everything is configured correctly, verify that the rewrite rules are correctly set in the Nginx configuration file or in the Plesk additional directives section. Ensure that the syntax is correct and that there are no typos or missing semicolons. Make sure to reload or restart the Nginx server after making any changes to the configuration. If the issue persists, consider seeking assistance from a web developer or system administrator with experience in Nginx configuration.
     
    GreenHost.Cloud, Jun 29, 2024 IP