Debian11快速安装网站搭建环境,代码如下:
#/bin/bash
apt-get update -y
apt-get install nginx-full php-fpm php-curl php-zip php-mysql php-mbstring php-xml php-gd mariadb-server -y
sed -i "s/\;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g" /etc/php/8.2/fpm/php.ini
sed -i "s/\post_max_size = 8M/post_max_size = 4000M/g" /etc/php/8.2/fpm/php.ini
sed -i "s/\upload_max_filesize = 2M/upload_max_filesize = 4000M/g" /etc/php/8.2/fpm/php.ini
/etc/init.d/php8.2-fpm restart
安装完成后修改/etc/nginx/nginx.conf,在http中添加
client_max_body_size 4000M;
安装完成后修改/etc/nginx/sites-available/default下location ~ .php$这一段配置关联php,如下:
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
# With php-cgi (or other tcp sockets):
#fastcgi_pass 127.0.0.1:9000;
}
/etc/init.d/nginx restart 即可。
更新可能会遇到Mariadb没有输入root密码也可以登录,状态如下:
mysql;
select user.plugin from mysql.user;
+-----------------------+
| plugin |
+-----------------------+
| unix_socket |
+-----------------------+
1 row in set (0.00 sec)
运行一下代码增加root密码,以及更新plugin默认值。
ALTER USER root@localhost IDENTIFIED VIA mysql_native_password USING PASSWORD("你的密码");;
FLUSH PRIVILEGES;
再次查询:
select user.plugin from mysql.user;
+-----------------------+
| plugin |
+-----------------------+
| mysql_native_password |
+-----------------------+
1 row in set (0.00 sec)
最后重启一下mysql服务吧。
/etc/init.d/mariadb restart
3 条评论
[....] Restarting nginx (via systemctl): nginx.serviceJob for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.
failed!
出现了这个错误是否能帮我解决下
Apr 22 15:31:46 instance-1 nginx[12010]: nginx: configuration file /etc/nginx/nginx.conf test failed
应该是nginx配置文件出错了。。你可以运行 nginx -t 看看那个地方写错了
● nginx.service - A high performance web server and a reverse proxy server
Docs: man:nginx(8)Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2018-04-22 15:31:46 UTC; 3s ago
Process: 11840 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exit
ed, status=0/SUCCESS)
Process: 12010 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1
/FAILURE)
Main PID: 21155 (code=exited, status=0/SUCCESS)
Apr 22 15:31:46 instance-1 systemd[1]: Starting A high performance web server and a reverse proxy server...
Apr 22 15:31:46 instance-1 nginx[12010]: nginx: [emerg] "fastcgi_pass" directive is duplicate in /etc/nginx/sites-e
nabled/default:53
Apr 22 15:31:46 instance-1 nginx[12010]: nginx: configuration file /etc/nginx/nginx.conf test failed
Apr 22 15:31:46 instance-1 systemd[1]: nginx.service: Control process exited, code=exited status=1
Apr 22 15:31:46 instance-1 systemd[1]: Failed to start A high performance web server and a reverse proxy se
rver.
Apr 22 15:31:46 instance-1 systemd[1]: nginx.service: Unit entered failed state.
Apr 22 15:31:46 instance-1 systemd[1]: nginx.service: Failed with result 'exit-code'.