lnmp环境安装Lsky Pro图床的方法
1:先下载最新版Lsky Pro源码
https://github.com/wisp-x/lsky-pro/releases
2:设置运行目录为 public
修改/usr/local/nginx/conf/vhost/域名.conf
root /home/wwwroot/public;
3:设置Rewrite 规则
在/usr/local/nginx/conf/rewritea目录下添加新的Rewrite规则文件.conf
location / { if (!-e $request_filename) { rewrite ^(.*)$ /index.php?s=$1 last; break; } }
编辑/usr/local/nginx/conf/vhost/域名.conf文件
server { listen 80; #listen [::]:80; server_name img.laoxu.cc ; index index.html index.htm index.php default.html default.htm default.php; root /home/wwwroot/public; include rewrite/****.conf; #将 ****.conf修改为新建Rewrite规则文件名 #error_page 404 /404.html; # Deny access to PHP files in specific directory #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; } include enable-php.conf; location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
Apache:
Apache 直接使用 .htaccess 即可
4:##lnmp防跨目录设置##
LNMP 1.2及更高版本防跨目录功能使用.user.ini,该文件在网站根目录下,可以修改.user.ini 里面的open_basedir的值来设置限制访问的目录或删除来移除防跨目录的设置。
.user.ini文件无法直接修改,如要修或删除需要先执行:chattr -i /网站目录/.user.ini
可以使用winscp文件管理、vim编辑器或nano编辑器进行修改。
删除的话rm -f /网站目录/.user.ini 就可以。
修改完成后再执行:chattr +i /网站目录/.user.ini
.user.ini不需要重启一般5分钟左右生效,也可以重启一下php-fpm立即生效。
如果要更改网站目录必须要按上述方法修改防跨目录的设置,否则肯定报错!!
LNMP 1.4或更高版本如果不想用防跨目录除需要删除.user.ini的防跨目录的目录还需要将 /usr/local/nginx/conf/fastcgi.conf 里面的fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/"; 在该行行前添加 # 或删除改行,需要重启nginx。
lnmp restart
5:将网站根目录权限所有者改为www
chown www:www -R /目录
6:安装完成以后
设置 runtime 目录 0755 权限,如果你使用本地存储,public 目录也需要设置为 0755 权限
chmod 755 -R /目录