Download
Nginx: http://nginx.org/en/download.html
Php: http://windows.php.net/download/
Mysql: http://dev.mysql.com/downloads/
Nginx selects the zip compressed package. If you run the gz compressed package, you will find that you cannot find a executable version. The version of the linux system corresponding to gz must be compiled before installation.
Nginx is the only thing with strict requirements on the path, because it was initially used for deployment in linux.
Mysql this database is relatively simple, just download an exe can be the next step of the installation, here I used a long time ago under a version of mysql-noinstall-5.1.44-win32.zip
For this version, you only need to extract it to the hard disk and then enter the bin directory. For example, if I put it on drive C
D: \ mysql \ bin> mysqld-install after mysqld-install is executed, the mysql service on port 3306 is automatically added and can be enabled at next startup.
Window does not start automatically after services are added by default.
D: \ mysql \ bin> net start mysql to enable the Service
What needs to be done later is to give the mysql root Password for login
D: \ mysql \ bin> mysql-u root-p
Enter password :******
Php installation is also relatively simple. Download and decompress
For ease of management, I have stored them in the server Directory of drive D: \ server \ php. php. ini is available here.
Too many changes to php. ini will not be mentioned.
Extension_dir = "./ext/" is modified. Otherwise, you will find that many dll does not work even if you remove the semicolon in the INI file, mainly because the ext path is not identified.
When PHP is started in general, there will be a dark window, so that PHP can be run in the background. I use the runhiddenconsole.exe file.
Create a new batfile and runhiddenconsole.exe in the same folder.
Bat code
@ Echo off
Echo Starting PHP FastCGI...
RunHiddenConsole.exe D: \ server \ php \ php-cgi.exe-B 127.0.0.1: 9000-c D: \ server \ php. ini
Nginx
In Windows, you must note that nginx can be started only in the full English path. If the path contains Chinese characters, nginx cannot be started.
Here I put nginx to D: \ server \ nginx
The configuration file to be modified is the configuration in the conf folder under the nginx directory.
Nginx. conf is the main configuration file to be started. I do not recommend making major changes to this file.
Before the last braces, add
Include vhost. conf;
Use the include method to load the startup that we need to customize
Vhost. conf code
Server {
Listen 80;
Server_name localhost;
# Charset koi8-r;
#===== Text Encoding
# Access_log logs/host. access. log main;
Location /{
# Root html; # This is the default path, that is, the folder in the nginx directory.
Root D: \ server \ www; # point to another directory
# Disable Directory Listing
Autoindex on;
# Automatically add a slash to the Nginx directory:
If (-d $ request_filename ){
Rewrite ^/(. *) ([^/]) $ http: // $ host/$1 $2/permanent;
}
Index index.html index.htm index. php;
}
# Error_page 404/404 .html;
# Redirect server error pages to the static page/50x.html
#
Error_page 500 502 503 x.html;
Location =/50x.html {
Root html;
}
Location ~ \. Php $ {
Root d: \ server \ www; # the resolution of the PHP file must be at the same level as the above root; otherwise there will be problems
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
Fastcgi_param SCRIPT_FILENAME d: \ server \ www \ $ fastcgi_script_name;
Include fastcgi_params;
}
}
Note: comment out the 80 server in nginx. conf.
Nginx startup: nginxdoes not have a regular window display. When you double-click nginx.exe, the server starts. You can see two nginx processes in the task manager.
You can only close the service by using the win command.
Here, I wrote out the commands for disabling nginx and php from my colleagues and saved them as bat.
Cmd code
@ Echo off
Echo Stopping nginx...
Taskkill/F/IM nginx.exe> nul
Echo Stopping PHP FastCGI...
Taskkill/F/IM php-cgi.exe> nul
Exit
This article is from "happysoul"