touch /etc/yum.repo.d/nginx.repo
vi /etc/yum.repo.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
yum -y install nginx php-fpm
vi /etc/nginx/nginx.conf
user nobody
vi /etc/php-fpm.d/www.conf
user nobody
group nobody
cp /etc/nginx/fastcgi_params /etc/nginx/fastcgi.conf
vi /etc/nginx/fastcgi.conf
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
vi /etc/nginx/conf.d/default.conf
server {
listen 80;
server_name test.test;
root /path;
index index.html index.htm index.php;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
}
}