hitl 发表于 2018-11-8 09:28:01

nginx access denied

  话说lnmp安装配置完了,真是不容易,测试竟然出现Access denied
  于是就找google 总结了一小下,一共大家共享
  1.目录权限不正确
  nginx默认站点目录是:/usr/share/nginx/html/
  权限设置:chown nginx.nginx/usr/share/nginx/html/ -R
  MySQL数据库目录是:/var/lib/mysql
  权限设置:chown mysql.mysql -R /var/lib/mysql
  2.查看有没添加php支持及目录下有没有文件
  vi /etc/nginx/conf.d/default.conf   #编辑
  index index.php index.html index.htm;   #增加index.php
  另外在目录中
  cd /usr/share/nginx/html/    ##查看是否有index.php 文件
  没有就新建一个
  touch index.php
  chmod 755 index.php
  vi index.php
  增加
  
  按ESC然后shift+:输入wq!
  3.修改security.limit_extensions添加一些常用的扩展名
  /etc/php-fpm.d/www.conf
  security.limit_extensions=.php .html .js .css .jpg .jpeg .gif .png .htm#(常用的文件扩展名)
  4.查看php配置中open_basedir选项
  /etc/php.ini
  open_basedir = .:/tmp/
  设置表示允许访问当前目录(即PHP脚本文件所在之目录)和/tmp/目录,可以防止php***跨站,如果改了之后安装程序有问题,可注销 此行,或者直接写上程序目录路径/var/www/html/www.iyunv.com/:/tmp/
  ,设置表示允许访问当前目录(即PHP脚本文件所在之目录)和/tmp/目录,可以防止php***跨站,如果改了之后安装程序有问题,可注销此行,或者直接写上程序目录路径/var/www/html/www.iyunv.com/:/tmp/(设置不当会提示‘Access denied.’)

页: [1]
查看完整版本: nginx access denied