1.下载安装windows的依赖vc++2015
https://www.microsoft.com/en-us/download/details.aspx?id=48145
2.安装部署php7.2.33
https://windows.php.net/download/
下载地址:
https://windows.php.net/downloads/releases/php-7.2.33-1-Win32-VC15-x64.zip
windows下添加php模块
nginx: [emerg] unknown directive "proxy_cache_purge"
windows下编译模块:http://nginx.org/en/docs/howto_build_on_win32.html
# 启用opcache
zend_extension=php_opcache.dll
# 安装
php: the ionCube PHP Loader
redis 扩展
php添加redis模块
a.下载dll文件,拷贝到php目录的ext目录
https://pecl.php.net/package/redis/5.0.2/windows
b.修改php.ini
extension=php_redis.dll
php7.2安装 the ionCube PHP Loader模块
下载 www.ioncube.com/loader-wizard/loader-wizard.zip 得到 loader-wizard.php 文件,放在更目录下访问
本机解析hosts 127.0.0.1 api.chinasoft.com
然后访问
https://api.chinasoft.com/loader-wizard.php
根据提示在php.ini中添加:zend_extension = "C:/wnmp/php-7.2.33/ext/ioncube_loader_win_7.2.dll"
3.Windows下搭建redis5.0.9环境
https://github.com/tporadowski/redis/releases/download/v5.0.9/Redis-x64-5.0.9.msi
配置文件:
修改监听的ip和密码
redis.windows-service.conf
4.配置nginx
可以使用RunHiddenConsole.exe 来进行nginx的管理
https://link.jianshu.com/?t=http://www.inbeijing.org/wp-content/uploads/2015/06/RunHiddenConsole.zip
下载nginx
nginx.conf 主配置文件#user apache; worker_processes 8;#error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info;pid logs/nginx.pid;worker_rlimit_nofile 65535;events {worker_connections 51200;multi_accept on; }http {include mime.types;include proxy.conf;default_type application/octet-stream;#set_real_ip_from 0.0.0.0/0;#real_ip_header X-Forwarded-For;#proxy_set_header Host $host; #proxy_set_header X-Real-IP $remote_addr; #proxy_set_header X-Forwarded-For $http_x_forwarded_for; #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_headers_hash_max_size 51200;proxy_headers_hash_bucket_size 6400;ssl_session_cache shared:SSL:200m;ssl_session_timeout 15m;#log_format main '$remote_addr - $remote_user [$time_local] "$request" '# '$status $body_bytes_sent "$http_referer" '# '"$http_user_agent" "$http_x_forwarded_for"';#log_format main '[$time_local] $remote_addr $status $request_time $body_bytes_sent "$request" "$http_referer" $upstream_addr $http_x_real_ip $http_x_forwarded_for $http_user_agent $request_filename';log_format main '$remote_addr - - [$time_local] - - "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$http_cookie" "$request_body" "$http_user_agent" $request_time '; sendfile on;tcp_nodelay on;keepalive_timeout 90;#----for upload fileclient_max_body_size 50m;#client_body_buffer_size 2M;#--- for resolve 400 errorclient_header_buffer_size 64k;large_client_header_buffers 4 64k;#proxy_connect_timeout 90s;#proxy_read_timeout 90s;#60s内后端服务器需要返回成功#proxy_send_timeout 90s; #proxy_buffer_size 16k;#proxy_buffers 4 32k;#proxy_busy_buffers_size 64k;#proxy_temp_file_write_size 64k;proxy_ignore_client_abort on; proxy_intercept_errors on;gzip on;gzip_vary off;gzip_min_length 1k;gzip_buffers 4 16k;gzip_http_version 1.0;gzip_comp_level 5;gzip_disable "MSIE [1-6]\.";gzip_types text/plain text/css text/javascript application/javascript application/x-javascript text/xml application/xml application/wasm;ssi on;ssi_silent_errors on;#ssi_types text/shtml;expires 60d;server_names_hash_bucket_size 20480;#if_modified_since before;#limit_req_zone $binary_remote_addr zone=all_zone:10m rate=3r/s;#limit_req zone=all_zone burst=2 nodelay;include vhost.d/*.conf;server {listen 80 default_server;server_name localhost;location / {root c:/wwwroot/api.chinasoft.com/httpdocs;index index.php index.html index.htm;}error_page 500 502 503 504 /50x.html;location = /50x.html {root html;}location /ws_status {stub_status on;access_log off;}location ~ ^/(status|ping)$ {include fastcgi_params;#fastcgi_pass unix:/tmp/php-cgi.sock;fastcgi_pass 127.0.0.1:9000;fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;}} }proxy.confproxy_temp_path proxy_temp_dir; proxy_cache_path proxy_cache_dir levels=1:2 keys_zone=cache_one:20m inactive=1d max_size=5g; client_body_buffer_size 512k; proxy_connect_timeout 60; proxy_read_timeout 60; proxy_send_timeout 60; proxy_buffer_size 32k; proxy_buffers 4 64k; proxy_busy_buffers_size 128k; proxy_temp_file_write_size 128k; proxy_next_upstream error timeout invalid_header http_500 http_503 http_404; proxy_cache cache_one;conf/vhosts.d/api.chinasoft.com.confserver {listen 80;server_name account.chinasoft.com api.chinasoft.com;access_log on;access_log C:/Users/Administrator/wwwroot/logs/nginx_log/access/api.chinasoft.com_access.log main ;error_log C:/Users/Administrator/wwwroot/logs/nginx_log/error/api.chinasoft.com_error.log ;root C:/Users/Administrator/wwwroot/api.chinasoft.com/api/public;index index.html index.shtml index.php ;include rewrite.d/api.chinasoft.com.conf ;if ($http_user_agent ~ Ezooms) {return 403;}location ~ ^.*\.(htaccess|htpasswd|ini|sh)$ {deny all;}if ($server_port !~ 443){rewrite ^(/.*)$ https://$host$1 permanent;}}server {listen 443 ssl;ssl_certificate cert2016/chinasoft_com.crt;ssl_certificate_key cert2016/chinasoft_com.key;ssl_dhparam cert2016/dh_2048.pem;ssl_session_timeout 5m;ssl_protocols TLSv1.1 TLSv1.2;ssl_ciphers "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!AES128-GCM-SHA256:!AES256-GCM-SHA384:!AES128-SHA256:!AES256-SHA256:!AES128-SHA:!AES256-SHA:AES:!CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA";ssl_prefer_server_ciphers on;# add_header Strict-Transport-Security max-age=15768000;#ssl_stapling on;#ssl_stapling_verify on;server_name account.chinasoft.com api.chinasoft.com;access_log C:/Users/Administrator/wwwroot/logs/nginx_log/access/api.chinasoft.com_access.log main ;error_log C:/Users/Administrator/wwwroot/logs/nginx_log/error/api.chinasoft.com_error.log ;root C:/Users/Administrator/wwwroot/api.chinasoft.com;index index.html index.shtml index.php ;include rewrite.d/api.chinasoft.com.conf ;error_page 404 403 /404.html;if ($http_user_agent ~ Ezooms) {return 403;}location ~ ^.*\.(htaccess|htpasswd|ini|sh)$ {deny all;}location ^~ /uploads/ {add_header Access-Control-Allow-Origin *;add_header Access-Control-Allow-Credentials true;root "C:/Users/Administrator/wwwroot/api.chinasoft.com/api/public/";}#反代清理缓存配置location ~ /purge(/.*) {proxy_cache_purge cache_one $1$is_args$args;}location /preview {alias C:/uploads;}location ~ \.php$ {# fastcgi_pass unix:/tmp/php-cgi.sock;fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;include fastcgi_params;}}