替换server部分
server {
listen 80;
server_name iwebshop.itcast.com;
#静态请求处理的location
location / {
root html/iwebshop;
index index.php index.html index.htm;
}
#动态请求处理的location
location ~* .*\.(php|php5)?$ {
root html/iwebshop;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
}
server {
listen 80;
server_name iwebshop.itcast.com;
#静态请求处理的location
location / {
root html/iwebshop;
index index.php index.html index.htm;
}
#动态请求处理的location
location ~* .*\.(php|php5)?$ {
root html/iwebshop;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
}
}
修改完配置文件后,检查语法并重启nginx服务
[root@localhost etc]# /data/server/nginx/sbin/nginx -t
nginx: the configuration file /data/server/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /data/server/nginx/conf/nginx.conf test is successful
[root@localhost etc]# service nginx stop
[root@localhost etc]# service nginx start
配置域名解析
[root@localhost html]# vim /etc/hosts
...
127.0.0.1 iwebshop.itcast.com