1024programmer Nginx Windows system installation and configuration Nginx+PHP5.3 server environment

Windows system installation and configuration Nginx+PHP5.3 server environment

1. Download nginx-0750-win32-setup.exe
And php5.3.4 (must be php-5.3.4-Win32-VC6-x86, not php-5.3.4-nts-Win32-VC6-x86, this version does not have php5ts.dll)

2. Install nginx (installed to C:\nginx by default), install php to C:\php, and then configure nginx:

#user nobody;

worker_processes 1;

#error_log logs/error.log;

#error_log logs/error.log notice;

#error_log logs/error.log info;

#pid logs/nginx.pid;

events {

worker_connections 1024;

}

http {

include
mime.types;

default_type application/octet-stream;

#log_format main ‘$remote_addr
– $remote_user [$time_local] “$request”‘

# # ‘”$status”
$body_bytes_sent “$http_referer”‘

# ‘”$http_user_agent”
“$http_x_forwarded_for”‘;

#access_log logs/access.log main;

sendfile on;

tcp_nopush
on;

#keepalive_timeout 0;

keepalive_timeout 65;

#gzip on;

server {

                 
80;

server_name localhost;

#charset
koi8-r;

#access_log logs/host.access.log main;

Location / {

root
html;

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 504 /50x.html;

location =
/50x.html {

root
html;

}

# proxy the PHP
scripts to Apache listening on 127.0.0.1:80

#

#location ~
\.php${

# proxy_pass
http://127.0.0.1;

#}

# pass the PHP
scripts to FastCGI server listening on 127.0.0.1:9000

#

location ~
\.php${

#root
html;

fastcgi_pass
127.0.0.1:9000;

  fastcgi_index index.php;

    fastcgi_param SCRIPT_FILENAME /nginx/html$fastcgi_script_name;

include fastcgi_params;

}

# deny access to
.htaccess files, if Apache’s document root

     # concurs with
nginx’s one

#

#location ~
/\.ht {

# deny all;

#}

}

}

3. Copy php.ini-production in the PHP directory to C:\WINDOWS and rename it to php.ini
Edit the php.ini file (modify doc_root = “C:\nginx\html” line 798 extension_dir =
“C:\php\ext” line 809, open extension=php_gd2.dll extension=php_mysql.dll, etc.)
date.timezOne=
Asia/Shanghai (to ensure that there will be no difference of 8 hours to obtain the current time) copy php5ts.dll and libmysql.dll (open MYSQL) in the PHP directory to C:\WINDOWS\system32 (simply Just copy the DLL files in the PHP directory to C:\WINDOWS\system32)

4. Start the nginx server, and then start the cgi server of php. For php cgi server, you can use the following command:
php-cgi.exe -b 127.0.0.1:9000
-q
C:\php>php-cgi.exe -b 127.0.0.1:9000 -q (run under the CMD command line, it cannot be started directly)

5. Write a simple PHPINFO to verify that PHP is working properly.

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/windows-system-installation-and-configuration-nginxphp5-3-server-environment/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索