Use Nginx in windows to replace apache as the server, nginxapache
To be honest, using Nginx in windows is a little inconvenient, but due to project requirements, you don't want to change the system (although you can have a virtual machine), you can only use Nginx.
Okay, I don't want to talk about it anymore...
First, I use xampp (Apache + Mysql + php + perl) with version 3.2.2.
I usually install xampp under D: \ xampp...
First download an Nginx package .. stamp this-> http://nginx.org/en/download.html has three versions (Mainline version/Stable version/Legacy versions) I'm under a Stable version that is Stable version, don't ask why, because stability!
After the download, decompress the package to D: \ xampp \ nginx ...:
Here you have to go to the php folder, Copy the php. ini file, named as php-cli.ini this is to play for Nginx .. without affecting the use of Apache ....
Okay. Here, open the php-cli.ini (we recommend that you open the text)
Configure the following items to search directly ::
Enable_dl = On;
Cgi. force_redirect = 0;
Cgi. fix_pathinfo = 1;
Fastcgi. impersonate = 1;
Cgi. rfc2616_headers = 1;
OK. Now you can open nginx.exe.
(Here-B should be a set of-a and-p)
Then open another cmd and enter D: \ xampp \ nginx
This is a little troublesome. If it fails, you have to re-open a cmd... D: \ xampp \ nginx-s reload.
If the configuration is changed, we recommend that you first use nginx-t to test whether an error is returned. Then reload or perform other operations.
Also, I have read what I said on the Internet and can use the RunHiddenConsole to manage Nginx (I have not tried it here, so I have to do it if I have time)
Note: nginx cannot be used with apache at the same time, because they all use the same port by default, so you have to disable apache when you enable nginx.
Nginx Configuration:
Open nginx \ conf \ nginx. conf
Here, I directly introduced folders to find other configurations.
Like this (-^ -)
Include web/*. conf;
Location /{
Root D:/xampp/htdocs /;
Index index.html index.htm index. php;
Autoindex on;
Autoindex_exact_size on;
Autoindex_localtime on;
}
Location ~ * \. Php $ {
Root D:/xampp/htdocs /;
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
Include fastcgi. conf;
}
Configure the root site...
Configure phpmyadmin.
Location =/phpmyadmin /{
Root D:/xampp /;
Index. php index.html index.htm;
}
Location ~ */Phpmyadmin/. * \. php {
Root D:/xampp /;
Include fastcgi. conf;
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
# Fastcgi_param SCRIPT_FILENAME D:/xampp/$ fastcgi_script_name;
}
Reload configuration >>> D: \ xampp \ nginx-t >>>d: \ xampp \ nginx-s reload
If the domain name is configured, it will not be written here. If not, www.baidu.com is a good thing.