1.安装nginx
2.安装mysql
3.安装php
4.nginx配置php
切换到nginx配置目录
cd /usr/local/nginx/conf
编辑nginx.conf
vim nginx.conf
一个server就是一个站点,改一下server里面的配置,把location ~ \.php$的注释打开,配置如下:
server {
listen 80;
server_name www.zhiboblog.com zhiboblog.com;
location / {
root /www/blog;
index index.php index.html index.htm;
}
location ~ \.php$ {
root /www/blog;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
}
listen 80;
server_name www.zhiboblog.com zhiboblog.com;
location / {
root /www/blog;
index index.php index.html index.htm;
}
location ~ \.php$ {
root /www/blog;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
}
listen是端口,server_name是域名,root是网站的根目录,这些可以根据自己的实际情况指定。