Laravel + PHP CGI + nginx configuration under Windows platform

Source: Internet
Author: User

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

The 2.nginx conf is configured as follows:


#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 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. Double-click Nginx.exe to start, OK

4. Attach bat for closing process

@echo off
echo Stopping Nginx ...
taskkill/f/im nginx.exe > nul
echo Stopping PHP FastCGI ...
taskkill/f/im php-cgi.exe > nul
Exit

5. Start 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

Laravel + PHP CGI + nginx configuration under Windows platform

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.