찾다
php教程php手册【PHP学习第一篇】PHP+nginx+windows初尝试

【PHP学习第一篇】PHPnginxwindows初尝试 鄙人以前现在都是做的JAVA开发,公司以后要给P2PP2C系统增加社区功能,众筹系统也是PHP开发的,因此决定学习下PHP。 废话不多说,直入正题,下载: Eclipse IDE for PHP developers 4.4 nginx1.7.1 PHP5.3.5 启动php

【PHP学习第一篇】PHP+nginx+windows初尝试

鄙人以前现在都是做的JAVA开发,公司以后要给P2P&P2C系统增加社区功能,众筹系统也是PHP开发的,因此决定学习下PHP。

废话不多说,直入正题,下载:

Eclipse IDE for PHP developers 4.4

nginx1.7.1

PHP5.3.5

启动php-cgi脚本(start-phpcgi.bat)如下:

@echo off
e:
cd E:\tools\php-5.3.5
echo "php-cgi is starting on 9000 port"
php-cgi.exe -b 127.0.0.1:9000
配置php.ini


nginx脚本配置

@echo off
E:\tools\nginx-1.7.1\nginx.exe
pause

nginx: [alert] could not open error log file: CreateFile() “logs/error.log” failed (3: The system cannot find the path specified)
2012/12/12 16:57:56 [emerg] 14312#10088: CreateFile() “C:\Users\[UserName]/conf/nginx.conf” failed (3: The system cannot find the path specified)

以上启动nginx脚本会报错:找不到log文件,修改如下:

@echo off
e:
cd E:\tools\nginx-1.7.1
echo "nginx is starting on port 80"
nginx.exe
pause
关闭命令行后需要打开任务管理器手动杀死nginx进程

nginx.conf文件如下:

worker_processes  1;
events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    #日志配置-可以去掉下面这三行
    log_format  access  '$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  access;
    error_log logs/nginx_error.log  debug;

    keepalive_timeout  65;

    server {
        listen   80;#nginx监听端口设置为80
        server_name  localhost;
        charset utf-8;#默认文件编码

        location / {                
            root   D:/www;#这里改成你自己的虚拟目录,注意!Nginx1.3.7及以下版本不支持文件路径中间有空格也不支持中文!!!这个以上的版本不知道会不会支持,不过这个以下是不支持的……虽然Apache支持啊……
            index  index.html index.htm index.php;#注意这里添加了index.php,如果没有添加这个有可能报403错误,这个是win下的,linux或者其他系统是否会有此问题未知。
            autoindex on;#如果文件不存在,列出目录树结构
        }
        location ~ \.php$ {
            fastcgi_pass   127.0.0.1:9000;#fastcgi监听的端口,与php的cgi启动时指定的要一致
            fastcgi_index  index.php;#默认首页
            fastcgi_param  SCRIPT_FILENAME D:/www$fastcgi_script_name;#启动路径,这里只需要将“D:/www”这部分改为你的安装路径就可以了
            include        fastcgi_params;
        }
    }


}



启动
start-phpcgi.bat

start-nginx.bat

访问:http://127.0.0.1/hello-php/hello.php



성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

AI Hentai Generator

AI Hentai Generator

AI Hentai를 무료로 생성하십시오.

뜨거운 도구

MinGW - Windows용 미니멀리스트 GNU

MinGW - Windows용 미니멀리스트 GNU

이 프로젝트는 osdn.net/projects/mingw로 마이그레이션되는 중입니다. 계속해서 그곳에서 우리를 팔로우할 수 있습니다. MinGW: GCC(GNU Compiler Collection)의 기본 Windows 포트로, 기본 Windows 애플리케이션을 구축하기 위한 무료 배포 가능 가져오기 라이브러리 및 헤더 파일로 C99 기능을 지원하는 MSVC 런타임에 대한 확장이 포함되어 있습니다. 모든 MinGW 소프트웨어는 64비트 Windows 플랫폼에서 실행될 수 있습니다.

SublimeText3 중국어 버전

SublimeText3 중국어 버전

중국어 버전, 사용하기 매우 쉽습니다.

에디트플러스 중국어 크랙 버전

에디트플러스 중국어 크랙 버전

작은 크기, 구문 강조, 코드 프롬프트 기능을 지원하지 않음

Atom Editor Mac 버전 다운로드

Atom Editor Mac 버전 다운로드

가장 인기 있는 오픈 소스 편집기

스튜디오 13.0.1 보내기

스튜디오 13.0.1 보내기

강력한 PHP 통합 개발 환경