Installation and configuration of Windows Nginx

Source: Internet
Author: User

First, to the official website to download the nginx1.0.11 version of Windows, official website download: http://nginx.org/download/nginx-1.0.11.zip

After downloading to the package, unzip the Nginx-nginx1.0.11.zip package to your favorite root directory and change the directory name to Nginx.

Then, perform the following actions:

CD Nginx

Start Nginx

In this way, the Nginx service is started. Open Task Manager to view the Nginx.exe process, with two processes showing up, consuming system resources, which is fairly small. Then open the browser, enter HTTP://127.0.0.1/can see Nginx welcome page, Very friendly

Nginx-s Stop//Stop Nginx
Nginx-s Reload//Reload configuration file
Nginx-s quit//exit Nginx

Today engaged in a N-long virtual directory configuration, in almost to give up when the occasional see an article, will my problem fix

My requirement is this, the system has a dedicated folder for storing pictures, css,js or attachments, such as:

Http://www.test.com/resources/images/a.jpg

Http://www.test.com/resources/css/a.css

Http://www.test.com/resources/js/a.js

Http://www.test.com/resources/attach/a.doc

This configuration is quite easy for Apache,

To access this folder through location URI rule matching, I use the following configuration:

Location ^~/resources/{
Root d:/www/;
}

Tried n many times can not access, has been reported 404, incomparable Cup! Finally read the above provided blog to solve, and found that the original blogger, no Real clear, location in the root and alias of the difference, and finally modified into:

Location ^~/resources/{
Alias d:/www/;
}

I was able to achieve my needs successfully.

The original stickers are as follows:

Niginx does not seem to have a virtual directory, but it is a workaround to specify the path to which Nginx accesses the request path.

(Original link http://ddbiz.com/?p=187)

server {
Listen default;
server_name _;

Location/{
root HTML;
Index 403.html;
}

Location ~//.ht {
Deny all;
}

location/phpadmin/{
alias/opt/www/phpadmin/;
Index index.php;
}

Location ~/.php$ {
Include httpd.conf;
}
}

It is important to note that location/phpadmin/{} and Location/phpadmin {} are completely different.

The former can access the directory, while the latter will be redirected to the server, such as: Http://127.0.0.1/phpadmin, will be redirected to Http://_/phpadmin

The following configuration is basically similar to the above, except that all access to/phpadmin/is parsed correctly, while other accesses return information that does not exist on the page (404).

server {
Listen default;
server_name _;

Location/{
root HTML;
#index 403.html;

return 404;
}

Location ~//.ht {
Deny all;
}

location/phpadmin/{
alias/opt/www/phpadmin/;
Index index.php;
}

Location ~/.php$ {
Include httpd.conf;
}
}

Original Sticker Address: http://blog.sina.com.cn/s/blog_6c2e6f1f0100l92h.html

Installation and configuration of Windows Nginx (GO)

Related Article

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.