[root@hcss-ecs-3f4blocal]# cd nginx-1.16.1 [root@hcss-ecs-3f4bnginx-1.16.1]# ls auto CHANGES CHANGES.ru conf configure contrib html LICENSE man README src [root@hcss-ecs-3f4bnginx-1.16.1]# [root@hcss-ecs-3f4bnginx-1.16.1]# [root@hcss-ecs-3f4bnginx-1.16.1]# ./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_image_filter_module --add-module=/usr/local/nginx-upstream-fair-master --with-stream --with-http_flv_module --with-http_gzip_static_module --with-pcre checking for OS + Linux 3.10.0-1160.119.1.el7.x86_64 x86_64
如下图,编译完成之后,如果没有报错的话,继续进行下一步即可。 接着进行编译make && make install 在进行make的时候,我这里报了一个错误,如下图,这是nginx的版本较高,所有的参数被取消,需要修改一下nginx中的配置文件。 修改nginx目录中的src/http/ngx_http_upstream.h 添加:in_port_t default_port; 修改完之后,在进行make && make install编译就正常了。
编写nginx的启动单元
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
[root@hcss-ecs-3f4bnginx-1.16.1]# vim /usr/lib/systemd/system/nginx.service [Unit] Description=nginx - high performance web server Documentation=https://nginx.org/en/docs/ After=network.target remote-fs.target nss-lookup.target
[root@hcss-ecs-3f4bnginx-1.16.1]# systemctl daemon-reload [root@hcss-ecs-3f4bnginx-1.16.1]# systemctl start nginx.service [root@hcss-ecs-3f4bnginx-1.16.1]# [root@hcss-ecs-3f4bnginx-1.16.1]# [root@hcss-ecs-3f4bnginx-1.16.1]# systemctl status nginx ● nginx.service - nginx - high performance web server Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled) Active: active (running) since Wed 2026-01-1421:47:54 CST; 5s ago Docs: https://nginx.org/en/docs/ Process: 2671 ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf (code=exited, status=0/SUCCESS) Process: 2669 ExecStartPre=/usr/local/nginx/sbin/nginx -t-c /usr/local/nginx/conf/nginx.conf (code=exited, status=0/SUCCESS) Main PID: 2674 (nginx) CGroup: /system.slice/nginx.service ├─2674 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf └─2675 nginx: worker process
Jan 1421:47:54 hcss-ecs-3f4b systemd[1]: Starting nginx - high performance web server... Jan 1421:47:54 hcss-ecs-3f4b nginx[2669]: nginx: the configuration file /usr/local/nginx/conf/nginx.conf sy...is ok Jan 1421:47:54 hcss-ecs-3f4b nginx[2669]: nginx: configuration file /usr/local/nginx/conf/nginx.conf test i...ssful Jan 1421:47:54 hcss-ecs-3f4b systemd[1]: Started nginx - high performance web server. Hint: Some lines were ellipsized, use -l to show in full. [root@hcss-ecs-3f4bnginx-1.16.1]# ss -luntp | grep 80 tcp LISTEN 0511 *:80 *:* users:(("nginx",pid=2675,fd=6),("nginx",pid=2674,fd=6))
[root@hcss-ecs-3f4bimagick-3.4.4]# systemctl daemon-reload [root@hcss-ecs-3f4bimagick-3.4.4]# systemctl start php-fpm [root@hcss-ecs-3f4bimagick-3.4.4]# systemctl enable php-fpm Created symlink from /etc/systemd/system/multi-user.target.wants/php-fpm.service to /usr/lib/systemd/system/php-fpm.service. [root@hcss-ecs-3f4bimagick-3.4.4]# netstat -anop | grep 9000 tcp 00127.0.0.1:90000.0.0.0:* LISTEN 26445/php-fpm: mast off (0.00/0/0) [root@hcss-ecs-3f4bimagick-3.4.4]#
编译安装mariadb10.6.24
安装稳定版mariadb10.6.24添加安装源:
1 2 3 4 5 6 7
[root@hcss-ecs-3f4bimagick-3.4.4]# vim /etc/yum.repos.d/mariadb.repo [mariadb] name = MariaDB baseurl = https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-10.6.24/yum/centos7-amd64/ gpgkey=http://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=0 enabled=1
安装mariadb
1 2 3 4 5 6
[root@hcss-ecs-3f4bimagick-3.4.4]# yum install MariaDB-server.x86_64 MariaDB-client.x86_64 MariaDB-devel.x86_64 root@hcss-ecs-3f4b imagick-3.4.4]# systemctl start mariadb.service [root@hcss-ecs-3f4bimagick-3.4.4]# systemctl enable mariadb.service Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service. [root@hcss-ecs-3f4bimagick-3.4.4]#
重置数据库root用户密码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#跳过权限表启动: [root@hcss-ecs-3f4blog]# mysqld_safe --skip-grant-tables --skip-networking & [root@hcss-ecs-3f4blog]# mysql -u root Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 3 Server version: 10.6.19-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type'help;' or '\h'for help. Type'\c' to clear the current input statement. MariaDB [(none)]> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]> ALTER USER 'root'@'localhost' IDENTIFIED BY 'root'; Query OK, 0 rows affected (0.000 sec)
[root@hcss-ecs-3f4blog]# ps -ef | grep mariadb mysql 299241023:04 pts/000:00:00 /usr/sbin/mariadbd --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --skip-grant-tables--skip-networking--log-error=/var/lib/mysql/hcss-ecs-3f4b.err --pid-file=hcss-ecs-3f4b.pid root 3072632704023:09 pts/000:00:00 grep --color=auto mariadb [root@hcss-ecs-3f4blog]# [root@hcss-ecs-3f4blog]# [root@hcss-ecs-3f4blog]# [root@hcss-ecs-3f4blog]# kill -9 29924 [root@hcss-ecs-3f4blog]# systemctl start mariadb # 使用刚刚设置的root密码登录数据库 [root@hcss-ecs-3f4blog]# mysql -uroot -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 3 Server version: 10.6.19-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type'help;' or '\h'for help. Type'\c' to clear the current input statement.