Sponsor:

Server and Web Integrator
Link:
Kloxo-MR logo
6.5.0 or 7.0.0
Click for "How to install"
Donation/Sponsorship:
Kloxo-MR is open-source.
Donate and or Sponsorship always welcome.
Click to:
Click Here
Please login or register. 2024-04-27, 14:57:28

Author Topic: Cara convert htaccess wordpress ke nginx  (Read 2427 times)

0 Members and 1 Guest are viewing this topic.

Offline indomovi

  • Junior Member
  • *
  • Posts: 29
  • Karma: +0/-0
    • View Profile
Cara convert htaccess wordpress ke nginx
« on: 2016-03-24, 05:37:45 »
Selamat siang,

mau tanya saya punya website wordpress pakai apache, sekarang mau coba pakai nginx, tapi saya binggung cara convert htaccessnya. file htaccees saya seperti ini :

Code: [Select]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
###Start Kloxo PHP config Area

### begin content - please not remove this line

### MR -- using php version different with default php
### 1. Using suphp
### - Copy between '#<FilesMatch \.php$>' to '#</FilesMatch>' and
###   then remove '#' from '#<FilesMatch', '#</FilesMatch>' and one of '#SetHandler'

#<FilesMatch \.php$>
#SetHandler x-httpd-php
#SetHandler x-httpd-php52
#SetHandler x-httpd-php53
#SetHandler x-httpd-php54
#SetHandler x-httpd-php55
#SetHandler x-httpd-php56
#SetHandler x-httpd-php70
#</FilesMatch>

### OR

### 2. Using fcgid
### - Copy from '#Options' to '#FCGIWrapper' and
###   then remove '#' for one of '#FCGIWrapper'

#Options +ExecCGI
#<FilesMatch \.php$>
# SetHandler fcgid-script
#</FilesMatch>
#FCGIWrapper /home/kloxo/client/php.fcgi .php
#FCGIWrapper /home/kloxo/client/php52.fcgi .php
#FCGIWrapper /home/kloxo/client/php53.fcgi .php
#FCGIWrapper /home/kloxo/client/php54.fcgi .php
#FCGIWrapper /home/kloxo/client/php55.fcgi .php
#FCGIWrapper /home/kloxo/client/php56.fcgi .php
#FCGIWrapper /home/kloxo/client/php70.fcgi .php

### end content - please not remove this line

###End Kloxo PHP config Area

sedangkan file php-fpm_standard.conf  saya seperti ini :

Code: [Select]
    ### MR -- just enough remove # below for enable nginx cache
    fastcgi_cache fcache;
    #fastcgi_cache_valid 200 1h;
    #fastcgi_cache_valid 301 1h;
    #fastcgi_cache_valid 302 1h;
    #fastcgi_cache_valid any 1m;
    ## for microcache
    fastcgi_cache_valid 200 10s;
    fastcgi_cache_use_stale updating;
    fastcgi_max_temp_file_size 1M;

    fastcgi_cache_key "$scheme$request_method$host$request_uri";
    add_header X-Micro-Cache $upstream_cache_status;

    ## MR - increasing upload size to 64M (declare inside 'location /' not work
    client_max_body_size 64M;
    client_body_buffer_size 128k;

    fastcgi_connect_timeout 600s;
    fastcgi_send_timeout 300s;
    fastcgi_read_timeout 300s;
    fastcgi_buffer_size 128k;
    fastcgi_buffers 8 128k;

    fastcgi_request_buffering off;

    ### MR -- must be using nginx with including ngx_purge_cache
    ### must be using special nginx (nginx with ngx_purge_cache include
    location ~ /purge(/.*) {
        ### MR -- just enough remove # below for enable purge_cache
        #proxy_cache_purge pcache "$scheme://$host$1$request_method";
        allow 127.0.0.1;
        deny all;
    }

    ### MR -- for userdir (access with http://ip/~user)
    location ~ ^/~(.+?)(/.*)?$ {
        if (!-f /home/$1/public_html/$2) {
            rewrite ^ 404;
        }

        alias '/home/$1/public_html$2';
        #autoindex on;
    }

    location ~ \.php$ {
        try_files $uri =404;

        #include fastcgi_params;

        #fastcgi_pass                      127.0.0.1:$var_fpmport;
        fastcgi_pass                      unix:/opt/configs/php-fpm/sock/$var_phpselected-$var_user.sock;
        fastcgi_index                     index.php;

        fastcgi_param  REDIRECT_STATUS    200;
        fastcgi_split_path_info           ^(.+\.php)(/.+)$;

        fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
        fastcgi_param  PATH_INFO          $fastcgi_path_info;
        fastcgi_param  PATH_TRANSLATED    $document_root$fastcgi_path_info;
 
        fastcgi_param  QUERY_STRING       $query_string;
        fastcgi_param  REQUEST_METHOD     $request_method;
        fastcgi_param  CONTENT_TYPE       $content_type;
        fastcgi_param  CONTENT_LENGTH     $content_length;
 
        fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
        fastcgi_param  REQUEST_URI        $request_uri;
        fastcgi_param  DOCUMENT_URI       $document_uri;
        fastcgi_param  DOCUMENT_ROOT      $document_root;
        fastcgi_param  SERVER_PROTOCOL    $server_protocol;
 
        fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
        fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;
 
        fastcgi_param  REMOTE_ADDR        $remote_addr;
        fastcgi_param  REMOTE_PORT        $remote_port;
        fastcgi_param  SERVER_ADDR        $server_addr;
        fastcgi_param  SERVER_PORT        $server_port;
        fastcgi_param  SERVER_NAME        $server_name;

        fastcgi_param  PHP_ADMIN_VALUE    'sendmail_path=/usr/sbin/sendmail -t -i';
        fastcgi_param  PHP_ADMIN_VALUE    'sendmail_from=$var_domain';
    }

    location / {
        ## MR -- move to ~lxcenter.conf
        #limit_conn addr 25;

        try_files $uri $uri/ /index.php;
    }

    location ~ ^/cgi-bin/.*\.(cgi|pl|py|rb) {
        gzip off;

        include fastcgi_params;

        fastcgi_pass 127.0.0.1:$var_fpmport;

        fastcgi_index cgi-bin.php;

        fastcgi_param SCRIPT_FILENAME /home/httpd/cgi-bin.php;
        fastcgi_param SCRIPT_NAME /cgi-bin/cgi-bin.php;
        #fastcgi_param X_SCRIPT_FILENAME /usr/lib$fastcgi_script_name;
        fastcgi_param X_SCRIPT_FILENAME $var_rootdir$fastcgi_script_name;
        fastcgi_param X_SCRIPT_NAME $fastcgi_script_name;
    }

maaf yah master klo pertanyaannya agak newbie banget,

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,807
  • Karma: +119/-11
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: Cara convert htaccess wordpress ke nginx
« Reply #1 on: 2016-03-24, 06:07:41 »
Semestinya default rewrite-rule dari wordpress ini di .htaccess sudah ditangani oleh default rewrite-rule yang sudah ada di nginx.
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline indomovi

  • Junior Member
  • *
  • Posts: 29
  • Karma: +0/-0
    • View Profile
Re: Cara convert htaccess wordpress ke nginx
« Reply #2 on: 2016-03-25, 05:28:27 »
terima kasih banyak pak mustafa  ;D

 


Top 4 Global Search Engines:    Google    Bing    Baidu    Yahoo

Page created in 0.038 seconds with 18 queries.

web stats analysis