• windows 下nginx php mysql memcache 的安装与配置(转)


    1、准备工作

    先到这儿下载官方的nginx for Windows 版本,并到PHP 官方下载php;到mysql官网下载mysql;到memcache官网下载memcache;

    2、nginx的安装很简单:解压后双击nginx.exe后服务即启动。这时打开浏览器在地址栏里输入 localhost或者127.0.0.1

    如果显示    Welcome to nginx!  表示nginx服务已启动。

    3、php安装同样简单,解压后 将php.ini-recommend 改名为php.ini并备份。

    4、关键步骤就是nginx启动php的配置和虚拟目录的配置。

    服务启动命令:serverstart.cmd       php的目录为D:\php5.2.13\

    @echo off
    REM “正在启动Nginx 服务器……..”
    start nginx
    REM “开始启动PHP FastCGI………”
    set PHP_FCGI_MAX_REQUESTS=1000
    echo Starting PHP FastCGI…
    RunHiddenConsole.exe D:\php5.2.13\php-cgi.exe -b 127.0.0.1:9000 -c D:\php5.2.13\php.ini

    服务停止命令:serverstop.cmd

    @echo off
    echo Stopping nginx…
    taskkill /F /IM nginx.exe > nul
    echo Stopping PHP FastCGI…
    taskkill /F /IM php-cgi.exe > nul
    exit

    服务重启命令:serverrestart.cmd

    @echo off
    echo Stopping nginx.exe…
    taskkill /F /IM nginx.exe > nul
    echo Stopping PHP FastCGI…
    taskkill /F /IM php-cgi.exe > nul
    echo Start nginx…
    start nginx
    echo Starting php-cgi…
    RunHiddenConsole.exe D:\PHP5.2.13\php-cgi.exe -b 127.0.0.1:9000 -c D:\PHP5.2.13\php.ini

    其中的RunHiddenConsole.exe是隐藏命令终端用的,因为命令当服务启动后命令终端是不会隐藏的,看着很是不舒服,故将其隐藏,下载RunHiddenConsole.exe

    下面是nginx.conf的配置:
    #user  nobody;
    #worker_processes  1;
    worker_processes  1;

    error_log  logs/error1.log;
    pid        logs/nginx.pid;

    events {
    worker_connections  1024;#每个进程处理的最大连接数65535
    }

    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  60;
    #gzip  on;

    server
    {
    listen       80;
    server_name  localhost;
    #Dir Browser
    autoindex on;
    #charset koi8-r;
    #access_log  logs/host.access.log  main;
    location / {
    root   D:/Nginx0.8.41/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   D:/Nginx0.8.41/html;
    }

    location ~ \.php$ {
    root           D:/Nginx0.8.41/html;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  D:/Nginx0.8.41/html$fastcgi_script_name;
    include        fastcgi_params;
    }
    }
    include vhost.conf;
    }

    虚拟目录vhost.conf的配置

    server
    {
    listen       80;
    #server_name  localtest.soujob.cn soujob.cn *.soujob.cn; #Multi domain renziming Add

    #error_page 404  /index.php?module=Error&action=NotFound;

    location / {
    root   D:/PHPproject/localtest.soujob.cn/SouJob;
    index  index.html index.htm index.php;
    }

    #rewrite ^/job?(.*)$ /index.php?$1 last;

    location ~ \.php$ {
    fastcgi_pass    127.0.0.1:9000;
    fastcgi_index   index.php;
    fastcgi_param  SCRIPT_FILENAME  D:/PHPproject/localtest.soujob.cn/SouJob$fastcgi_script_name;
    include        fastcgi_params;
    }
    }

    php.ini的配置:主要就是将extension_dir = “D:\PHP5.2.13\ext”  php的扩展目录 ,然后打开php的常用扩展。

    然后再nginx的html文件夹中 写phpinfo.php。打开浏览器在地址栏里输入localhost/phpinfo.php 查看结果。

    memcache的安装与配置

    解压到d:\memcache 。

    打开cmd 进入到memcache的目录,输入 memcache.exe  -d install 安装

    然后再 输入memcache.exe -d start 启动。 即可。

    下载php_memcache.dll放在 php的ext扩展目录里,在php.ini中打开即可。

    aliyun活动 https://www.aliyun.com/acts/limit-buy?userCode=re2o7acl
  • 相关阅读:
    量子力学与广义相对论的统一——用广义相对论解释海森堡测不准原理 Unification of Quantum Mechanics and General Relativity: Explaining Heisenberg Uncertainty Principle with General Relativity
    用光的微粒说和广义相对论来解释衍射现象 Explanation of Diffraction Phenomenon by Particle Theory of Light and General Relativity
    质量能量等效的泛化--物理学定律方程与等效原理的对应关系 Generalization of Mass-Energy Equivalence--Corresponding Relations between Equations of Physical Laws and Equiva
    关于质能等效的两个思想实验 Two Ideological Experiments on Mass-Energy Equivalence
    购物商城Web开发第十七天
    购物商城Web开发第十六天
    购物商城Web开发第十五天
    购物商城Web开发第十四天
    购物商城Web开发第十三天
    暑假周总结二
  • 原文地址:https://www.cnblogs.com/wangbin/p/1913855.html
Copyright © 2020-2023  润新知