手机微网站与微官网,做网站优化词怎么选择,织梦 网站无法显示该页面,深圳ppt设计公司发布于 2023-07-17 在 https://chenhaotian.top/linux-app/easy-image/
前言
如果不希望安装宝塔面板或其国际版 aapanel#xff08;尽管宝塔面板可以在安装后关闭#xff09;#xff0c;那么可以参考这篇文章。
本文安装环境为 Debian 11, 在 Ubuntu 20.04 测试通过
安…发布于 2023-07-17 在 https://chenhaotian.top/linux-app/easy-image/
前言
如果不希望安装宝塔面板或其国际版 aapanel尽管宝塔面板可以在安装后关闭那么可以参考这篇文章。
本文安装环境为 Debian 11, 在 Ubuntu 20.04 测试通过
安装 PHP
安装 PHP 7.4
apt update -y
apt install php7.4 php7.4-fpm 安装 PHP 拓展
apt install php7.4-fileinfo php7.4-iconv php7.4-zip php7.4-mbstring php7.4-gd配置 PHP
vim /etc/php/7.4/fpm/php.ini查找 upload_max_filesize post_max_size memory_limit 按需求设置。 重启 PHP
systemctl restart php7.4-fpm安装 Nginx
安装 Nginx
apt install nginx拉取网站代码
cd /var/www/html
git clone https://github.com/icret/EasyImages2.0.git赋予适当权限
chmod -R 755 /var/www/html/EasyImages2.0/
chown -R www-data:www-data /var/www/html/EasyImages2.0/配置 Nginx
rm /etc/nginx/sites-enabled/default
vim /etc/nginx/sites-enabled/default填入以下配置注意更改域名
此时不需要配置 443 监听和 SSL之后由 Certbot 自动配置
server {server_name image.example.com; # 你的域名listen 80;root /var/www/html/EasyImages2.0/;index index.php index.html;client_header_timeout 300s;client_body_timeout 300s; # 防止大图片上传超时client_max_body_size 2000m; # 应不小于100m防止上传大图片 HTTP 413 错误location / {try_files $uri $uri/ 404;}location ~ \.php$ {include snippets/fastcgi-php.conf;fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;}location ~ /\.ht {deny all;}location ~* ^/(config|docs|i|public)/.*\.(php|php5)$ {deny all; # 安全设置}
}检查配置文件
nginx -t如果出现以下内容表示正常
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful重启 Nginx
systemctl restart nginx使用 Certbot 为 Nginx 配置 SSL 证书
apt install certbot python3-certbot-nginx
certbot --nginx -d your_domain #你的域名测试证书自动更新
certbot renew --dry-run安装环境部署完毕访问你的域名即可进行网站初始化。
如果一切正常检测结果应为全部通过。 注意事项 / 提示 官方 Github 仓库https://github.com/icret/EasyImages2.0/ 所有操作以 root 权限进行 Vim 的操作可自行寻找教程或询问 ChatGPT 更改 PHP 和 Nginx 配置文件后记得重启 systemctl restart php7.4-fpm
systemctl restart nginx从其他图床迁移图片后记得更改图片权限为 0755 (或0644) 和 www-data chmod -R 755 /var/www/html/EasyImages2.0/
chown -R www-data:www-data /var/www/html/EasyImages2.0/