Nginx + PHP configuration and startup script _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
Nginx + PHP configuration and startup script. Success;} location ~ *. Make a note.

# Nginx. conf

Server {
Listen 8080;
Server_name localhost;

Location /{
Root/home/work/htdocs;
Expires 1d;
Autoindex on;
Index. php index.html;
}
Location ~ * \. Php $ {
Root/home/work/htdocs;
Fastcgi_pass 127.0.0.1: 30000;
Fastcgi_index index. php;
Fastcgi_param SCRIPT_FILENAME/home/work/htdocs/$ fastcgi_script_name;
Client_max_body_size 100 m;
Include fastcgi_params;
Fastcgi_connect_timeout 1000 s;
Fastcgi_send_timeout 1000 s;
Fastcgi_read_timeout 1000 s;
}
}

# Nginx. sh ngix startup script

#! /Bin/sh
Case "$1" in
'Start ')
Sudo/usr/local/nginx/sbin/nginx-s start
;;
'Stop ')
Sudo/usr/local/nginx/sbin/nginx-s stop
;;
'Restart ')
Sudo/usr/local/nginx/sbin/nginx-s reload
;;
*)
Echo "Usage: $0 {start | stop }"
Exit 1
;;
Esac

# Spaw-php.sh php-cgi startup script
#! /Bin/sh
Dir = 'dirname $0'
PID_FILE =/home/work/htdocs/spaw-php.pid
PHP_FCGI = "/home/work/php/bin/php-cgi-f/home/work/htdocs/php. ini"

Case "$1" in
'Start ')
Spawn-fcgi-C 3-p 30000-f "$ PHP_FCGI"-P $ PID_FILE
;;
'Stop ')
Kill 'cat $ PID_FILE'
;;
'Restart ')
Kill 'cat $ PID_FILE'
Spawn-fcgi-C 3-p 30000-f "$ PHP_FCGI"-P $ PID_FILE
;;
*)
Echo "Usage: $0 {start | stop }"
Exit 1
;;
Esac


From ideawu

Ingress. # nginx. conf server {listen 8080; server_name localhost; location/{root/home/work/htdocs; expires 1d; autoindex on; index. php index.html;} location ~ *\....

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.