laravel + php cgi + nginx在windows平台下的配置

1.d:\xampp\php\php-cgi.exe -b 127.0.0.1:9000 -c d:\xampp\php\php.ini

2.nginx conf配置如下:

#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 {
listen 80;
server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

#location / {
# root html;
# index index.html index.htm;
#}
location / {
root e:/source/game/public;
index index.html index.htm index.php;
try_files $uri $uri/ /index.php?$query_string;
}

#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 /scripts$fastcgi_script_name;
# include fastcgi_params;
#}

location ~ \.php$ {
root e:/source/game/public;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME e:/source/game/public$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;
#}
}

# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;

# location / {
# root html;
# index index.html index.htm;
# }
#}

# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;

# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;

# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;

# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;

# location / {
# root html;
# index index.html index.htm;
# }
#}

}

3.双击nginx.exe启动,ok

4.附上关闭进程的bat

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

5.启动web_runat.vbs

Function process(name)
process = False
Dim o, a, i
set o = GetObject("WinMgmts:")
Set a = o.InstancesOf("Win32_Process")
For Each i In a
If InStr(UCase(name), UCase(i.Description)) <> 0 Then
process = True
Exit For
End If
Next
Set a = Nothing
Set o = Nothing
End Function
Sub closeProcess(name)
Dim o
Set o = CreateObject("Wscript.Shell")
Do While process(name) = True
o.Run "cmd.exe /C Taskkill /f /im " & name, 0
Wscript.Sleep 1000
Loop
Set o = Nothing
End Sub
Call closeProcess("nginx.exe")
Call closeProcess("php-cgi.exe")
Dim o
Set o = CreateObject("Wscript.Shell")
o.Run "..\php\php-cgi.exe -b 127.0.0.1:9000", 0
o.Run "nginx.exe", 0
Set o = Nothing

时间: 2024-08-09 05:34:36

laravel + php cgi + nginx在windows平台下的配置的相关文章

Nginx在Windows平台的配置

Nginx在Windows平台的配置 能够使用Nginx搭建Tomcat集群,并完成负载均衡. 1.什么是Nginx 2.为什么使用Nginx 背景: 互联网飞速发展的今天,大用户量高并发已经成为互联网的主体.怎样能让一个网站能够承载几万个或几十万个用户的持续访问呢?这是一些中小网站急需解决的问题.用单机tomcat搭建的网站,在比较理想的状态下能够承受的并发访问量在150到200左右.按照并发访问量占总用户数量的5%到10%这样计算,单点tomcat网站的用户人数在1500到4000左右.对于

Windows平台下利用APM来做负载均衡方案 - 负载均衡(下)

概述 我们在上一篇Windows平台分布式架构实践 - 负载均衡中讨论了Windows平台下通过NLB(Network Load Balancer) 来实现网站的负载均衡,并且通过压力测试演示了它的效果,可以说还是非常的理想的.同时我们也收集到了不少的问题,比如说如何在这种分布式的架构下使用Session,NLB中有一台服务器挂掉了会导致对外暴露的地址无法访问,如果实现服务器之间的同步,如果更好的进行热修复等等,还有我们在上一篇中也提到了NLB所提供的功能是非常简单的,为了回答我们前面提到的问题

Windows平台下安装Hadoop

1.安装JDK1.6或更高版本 官网下载JDK,安装时注意,最好不要安装到带有空格的路径名下,例如:Programe Files,否则在配置Hadoop的配置文件时会找不到JDK(按相关说法,配置文件中的路径加引号即可解决,但我没测试成功). 2.安装Cygwin Cygwin是Windows平台下模拟Unix环境的工具,需要在安装Cygwin的基础上安装Hadoop,下载地址:http://www.cygwin.com/ 根据操作系统的需要下载32位或64的安装文件. 1).双击下载好的安装文

windows平台下基于VisualStudio的Clang安装和配置

LLVM 是一个开源的编译器架构,它已经被成功应用到多个应用领域.Clang是 LLVM 的一个编译器前端,它目前支持 C, C++, Objective-C 以及 Objective-C++ 等编程语言.Clang 对源程序进行词法分析和语义分析,并将分析结果转换为 AST ( 抽象语法树 ) ,最后使用 LLVM 作为后端代码的生成器. Clang 的开发目标是提供一个可以替代 GCC 的前端编译器.与 GCC 相比,Clang 是一个重新设计的编译器前端,具有一系列优点,例如模块化,代码简

windows平台下安装与配置mysql5.7

博主QQ:819594300 博客地址:http://zpf666.blog.51cto.com/ 有什么疑问的朋友可以联系博主,博主会帮你们解答,谢谢支持! 在windows上安装mysql5.7需要具有系统的管理员权限. Windows平台下提供两种安装方式: 1.mysql二进制分发版(.msi安装文件) 2.免安装版(.zip压缩文件) 一般来讲,我们使用二进制分发版,因为该版本比其他的分发版本使用起来要简单,不再需要其他工具来启动就可以运行mysql. 本例以window7平台为例进行

Windows平台下搭建Git服务器的图文教程

Git没有客户端服务器端的概念,但是要共享Git仓库,就需要用到SSH协议(FTP , HTTPS , SFTP等协议也能实现Git共享,此文档不讨论),但是SSH有客户端服务器端,所以在windows下的开发要把自己的Git仓库共享出去的话,就必 须做SSH服务器 Git服务现在独树一帜,相比与SVN有更多的灵活性,最流行的开源项目托管网站Github上面,如果托管开源项目,那么就是免费使用的,但是闭源的项目就会收取昂贵的费用,如果你不缺米,那么不在本文讨论的范围内,既然这样,我们可以自己搭建

MiinCMP SAE版修正windows平台下无法获取文档问题

原因:在本地测试时,出现文件路径错误,windows下路径为\ROOT\WEB-INF\,统一转换为/ROOT/WEB-INF/ @Override     public String readFile(File file,String encode){                 String pathweb=parentWebDir;// +"/"+  path;       File f=new File(pathweb);              String path=

OpenCV在Windows平台下的源码编译

OpenCV库官方网站为http://opencv.org/. 在该网站可以下载最新的OpenCV for Windows,例如当前我下载的是opencv-2.4.9.exe ,双击该文件解压到某个目录下,解压后的根目录为opencv,opencv目录下有2个子目录,分别为build和sources,build目录中存放的是已经编译好的库,而sources目录中存放的是源代码.下面我们会在sources目录中编译源代码. 在sources目录中可以看到有个CMakeLists.txt文件,这个文

MongoDB学习总结(一) —— Windows平台下安装

一.基本概念 MongoDB是一个基于分布式文件存储的开源数据库系统,皆在为WEB应用提供可扩展的高性能数据存储解决方案.MongoDB将数据存储为一个文档,数据结构由键值key=>value组成.文档类似JSON对象.字段值可以包含其他文档,数组及文档数组. MongoDB数据库的几个基本概念: 1)一个 MongoDB 实例中,可以有零个或多个database(数据库). 2)数据库中可以有零个或多个 collections (集合).相当于传统关系数据库中table(表). 3)集合是由零