Want more timely Centmin Mod News Updates?
Become a Member

convert apache rewrites to nginx rewrites

Discussion in 'Other Web Apps usage' started by Altair, Aug 28, 2020.

  1. Altair

    Altair Member

    58
    3
    8
    Jan 27, 2018
    Ratings:
    +3
    Local Time:
    2:55 PM
    i have an application that requires rewrite_module for friendly urls.


    I also have an .htaccess file inside the application folders, its content is below:

    <IfModule mod_rewrite.c>
    RewriteEngine Off
    </ifModule>

    FileETag INode MTime Size

    <ifModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault "access plus 300 days"
    </ifModule>

    <IfModule mod_gzip.c>
    mod_gzip_on Yes
    mod_gzip_dechunk Yes
    mod_gzip_item_include file \.(js|css)$
    mod_gzip_item_include mime ^text/.*
    </IfModule>

    <IfModule !mod_gzip.c>
    <IfModule mod_deflate.c>
    <FilesMatch "\.(js|css)$">
    SetOutputFilter DEFLATE
    </FilesMatch>
    </IfModule>
    </IfModule>

    AddType text/plain .php .php3 .php4 .php5 .phtml .pl .py .jsp .asp .shtml .sh .cgi .htm .html

    how do I convert this into nginx syntax i looked at the page nginx configuration examples but couldn't find intel as my application is custom and not common

    @eva2000
     
  2. eva2000

    eva2000 Administrator Staff Member

    45,201
    10,280
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,934
    Local Time:
    9:55 PM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    All the above is for setting browser cache control/expires headers and gzip compress of static files which you do not need with Centmin Mod Nginx as out of the box nginx vhosts created all have expire headers/cache control set for static files in global server wide include file at /usr/local/nginx/conf/staticfiles.conf as per Centmin Mod Configuration Files - CentminMod.com LEMP Nginx web stack for CentOS

    and gzip compression server wide in /usr/local/nginx/conf/nginx.conf
    Code (Text):
            gzip on;
            gzip_vary   on;
            gzip_disable "MSIE [1-6]\.";
            gzip_static on;
            gzip_min_length   1400;
            gzip_buffers      1024 8k;
            gzip_http_version 1.0;
            gzip_comp_level 5;
            gzip_proxied    any;
            gzip_types text/plain text/css text/xml application/javascript application/x-javascript application/xml application/xml+rss application/ecmascript application/json image/svg+xml;