Linux under Nginx Support. htaccess file implementation Pseudo-static method

Source: Internet
Author: User

in the Google search data Many people say Nginx does not support. htaccess file, I followed the nginx rule test, the results found Nginx is fully supported. htaccess file!

Here's how:

1. Create a new. htaccess file in the directory where you want to use the. htaccess file,
As one of my Discuz Forum Directory:

Vim/var/www/html/168pc/bbs/.htaccess

2. Enter the rules inside and I'll enter the pseudo-static rules for Discuz:

# nginx  rewrite

Wq Save exit.

3. Modify the Nginx configuration file:

vim/etc/nginx/ nginx.conf

4. Introduce the. htaccess file in the server{} that needs to add pseudo-static virtual hosts :

Include/var/www/html/168pc/bbs/.htaccess (change this to the exact location of your. htaccess file)

Wq Save exit.

5. Reload the Nginx configuration file:

/etc/init.d/nginx Reload

Re-open the Web page and see if pseudo-static normal proves that your rewrite rule syntax is correct.

Normal, finished!

add: I found on the internet a can be online Apache rewrite pseudo-static rules are automatically converted to Nginx rewrite Web pages. We can try it.

http://www.anilcetin.com/convert-apache-htaccess-to-nginx/

The contents of this address include the ability to complete the above-mentioned minor modifications. is to automatically convert the rules in. htaccess to the rules available under Nginx.

Summary: the. htaccess file was originally a distributed configuration file for Apache, providing a way to change the configuration for each directory, that is, to place a file containing instructions in a particular directory, where the instructions are applied to this directory and all its subdirectories. In fact, to modify the Nginx can also use the. htaccess file for a variety of functions. Implementing pseudo-Static is just one of the purposes of. Htaccess. Htaccess can also do a lot of purposes, such as filtering access to IP, setting Web Directory access permissions, passwords, and so on.


Linux under Nginx Support. htaccess file implementation Pseudo-static method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.