30826 大佬有话说 : 2019-12-1 14:34:54
受不了宝塔,分享Debian10安装LNMP教程
本帖最后由 30826 于 2019-12-1 15:45 编辑
详情见上回,宝塔编译了9个小时还失败了:
https://www.hostloc.com/thread-613931-1-1.html
已经卸载宝塔,分享一个自用的Debian10下手动安装LNMP的教程。
也没比面板复杂到哪去,安装速度有质的飞跃。
先升级系统组件到最新:
apt update && apt dist-upgrade
安装常用组件:
apt install cron rsync openssl xinetd haveged sshguard lsb-release ca-certificates apt-transport-https
创建/www目录:
mkdir /www
安装Nginx:
apt install nginx
service nginx start
假如我有abc.com,用SFTP建立网站配置/etc/nginx/conf.d/abc.conf:
server {
listen 80;
server_name abc.com www.abc.com;
index index.html index.htm index.php;
root /www/abc;
if ($scheme != https) { //强制HTTPS
rewrite ^/(.*) https://$server_name/$1 permanent;
}
location ~* .php$ {
include fastcgi_params;
fastcgi_pass unix:/var/php.sock;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param PHP_VALUE "open_basedir=$document_root:/tmp/:/proc/";
}
}
配置完重启Nginx:
service nginx restart
安装SSL申请系统:
wget https://dl.eff.org/certbot-auto –no-check-certificate && chmod a+x certbot-auto
按提示输入需要证书的域名,安装证书:
./certbot-auto –nginx –no-redirect
编辑计划任务,定时续期SSL:
crontab -e
计划任务这里需要使用nano编辑器,粘贴此命令到文件底部,按Ctrl+X退出并选择保存。
0 1 * * * /root/certbot-auto renew –post-hook "service nginx reload"
安装最新版PHP,数据库自行选择用sqlite还是mysql:
apt install php-fpm php-xml php-opcache php-mbstring php-gd
apt install php-sqlite3
apt install php-mysql
建立快捷方式,等PHP7.4有了以后,升级PHP并重新关联php7.4-fpm.sock就行:
ln -s /run/php/php7.3-fpm.sock /var/php.sock
service php*-fpm start
安装MariaDB,不用MySQL的可以跳过了:
apt install mariadb-server
service mariadb start
启动MariaDB配置向导,跟着向导走就行,配置root密码:
mysql_secure_installation
建立数据库(比如abc):
CREATE DATABASE `abc` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
建立数据库用户(比如abc,密码123):
CREATE USER ‘abc’@’localhost’ IDENTIFIED BY ‘123’;
把用户授权到数据库:
GRANT ALL ON abc.* TO ‘abc’@’localhost’;
完事以后就可以用(用户abc,密码123)登录数据库abc了。
全部教程完。
aming 大佬有话说 : 2019-12-1 16:19:34
给LZ补充下,
MariaDB(官方,这样可选版本,按步骤操作即可)
https://downloads.mariadb.org/mariadb/repositories/#mirror=jaleco
用 Percona 的话,则
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb && dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
apt update && apt install -y percona-server-server-5.7
aming 大佬有话说 : 2019-12-1 16:15:26
ILL 大佬有话说 : 2019-12-1 15:39
编译和安装能一样吗。。
你想了解差异,可以上网查看文章,有人专门跑测试,国人文章也有,结果甚至是包比编译更优秀。
可以跟你说相差很微,是你体验不到。
现在大概也就国人还特么迷信centos+编译安装php的,老外基本都是直接包安装,遇到没有才会编译
maiawpyg 大佬有话说 : 2019-12-1 14:57:21
手动那么香吗 一键不用
天有点热 大佬有话说 : 2019-12-1 15:15:16
大佬真能折腾,网站月入过三万了吧
nic2013 大佬有话说 : 2019-12-1 14:35:59
进来学习一下。
shares 大佬有话说 : 2019-12-1 14:39:00
这个教程不错
一直用lnmp
现在应该到了1.6了
cnly1987 大佬有话说 : 2019-12-1 14:41:24
wget http://soft.vpser.net/lnmp/lnmp1.6.tar.gz -cO lnmp1.6.tar.gz && tar zxf lnmp1.6.tar.gz && cd lnmp1.6 && ./install.sh lnmp
doing 大佬有话说 : 2019-12-1 14:42:03
一看大佬就是土豪,动不动就update,很多小鸡update都带不起来
xcy1020 大佬有话说 : 2019-12-1 14:42:19
:lol:lol:lol:loloneinstack
xuh 大佬有话说 : 2019-12-1 14:45:53
用oneinstack了
asp 大佬有话说 : 2019-12-1 14:48:24
加油~~~
myseil 大佬有话说 : 2019-12-1 14:48:51
教程很好。我还是选择使用宝塔
Crying 大佬有话说 : 2019-12-1 14:51:36
自己编译,它能不香嘛