Nginx和php安装及配置第三篇:nginx的配置文件

1、打开配置文件:/usr/local/nginx-1.8.0/conf/nginx.conf

这里 root就是代码指向的目录

       server_name就是域名

       location/  表示匹配所有url都执行匹配后操作,这里下面做了一个rewrite:

         if (!-e $request_filename){

            rewrite ^/(.*)$ /index.php/$1 last;

     }

       这个rewrite就是表示匹配到符合这里正则的url就自动添加上index.php,起到了帮我们的url自动补上index.php的作用,缩短了我们的url访问长度