bqx619

1.ubuntu15.10,nginx1.4,php5.5

2.集成包phpstudy

3.配置虚拟主机

  i)、/phpstudy/server/nginx/config/nginx.conf为默认nginx配置文件,一般无需修改

  ii)、添加虚拟主机只需修改/phpstudy/server/nginx/config/vhost(需要root权限,建议先设置为777)目录下文件,默认存在一隐藏文件phpstudy.conf,添加文件内容

    

server{
        listen 80;
        server_name 192.168.65.92; //网站、域名
    root /phpstudy/www/upload; //目录
        index index.php index.html; //出现405.File not found.等的解决
     location /{
                root /phpstudy/www/upload;
                index index.php index.html;
        }
        location ~ \.php(.*)$ {//解析php
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_param  PATH_INFO  $fastcgi_path_info;
            fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
            include        fastcgi_params;
        }
    location /api{
        autoindex on;
    }

}

自行根据需要增添文件。

3.注意设置文件夹权限,autoindex on和设置777或chown -R nginx_user:nginx_user /htdocs

分类:

技术点:

相关文章:

  • 2021-11-19
  • 2021-09-02
  • 2022-12-23
  • 2022-01-15
  • 2021-10-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-11
  • 2022-01-01
  • 2021-07-04
  • 2021-06-28
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案