1、在 nginx.conf中加入 include vhost/*.conf;
2、在/usr/local/nginx/conf/vhost中新建 ibkdist.com.conf文件,并加入一下代码
server {
server_name ibkdist.com;
listen 80;
location / {
root /mnt/hgfs/website/ibk;
index index.html index.php;
if (!-e $request_filename){
rewrite ^/(.*) /index.php last;
}
}
location ~ \.php$ {
root /mnt/hgfs/website/ibk;
fastcgi_pass unix:/tmp/php-cgi.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
fastcgi_param SCRIPT_FILENAME /mnt/hgfs/website/ibk$fastcgi_script_name;
# include fastcgi_params;
}
}
3、在 etc/hosts文件中加入127.0.0.1 ibkdist.com
4
/etc/init.d/nginx restart