useradd www -s /sbin/nologin -M
wget http://nginx.org/download/nginx-1.6.3.tar.gz
tar xzf nginx
./configure --prefix=/data/server/nginx
[./configure: error: C compiler cc is not found]
yum -y install gcc
[he HTTP rewrite module requires the PCRE library.]
yum -y install pcre-devel
[./configure: error: the HTTP gzip module requires the zlib library.]
yum install -y zlib-devel
make&&makeinstallvim /data/server/nginx/conf/nginx.conf
修改第一行
user nobody
为
user www;
启动
./sbin/nginx
关闭
./sbin/nginx -s stop
重启
./sbin/nginx -s reload
mysql
useradd -s /sbin/nologin -M mysql
wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.26-el7-x86_64.tar.gz
tar xzf mysql-8.0.26-el7-x86_64.tar.gz -C /data/server
cd /data/server
mv mysql-8.0.... mysql 改名
cd mysql
#bin/mysqld --initialize --user=mysql --basedir= 安装目录 --datadir= 数据存放目录
bin/mysqld --initialize --user=mysql --basedir=/data/server/mysql --datadir=/data/server/mysql/data
#这里会有密码,记住
#密码
root@localhost: brQaLw.Qu6bV
vim /etc/my.cnf
[mysqld]
basedir = /data/server/mysql
datadir=/data/server/mysql/data
#socket=/data/server/mysql/mysql.sock
character-set-server=utf8
port=3306
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
#
[client]
# # 设置mysql客户端连接服务端时默认使用的端口和默认字符集
port=3306
default-character-set=utf8
# Disabling symbolic-links is recommended to prevent assorted security risks
#symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
[mysqld_safe]
#log-error=/var/log/mariadb/mariadb.log
#pid-file=/var/run/mariadb/mariadb.pid
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
chown -R mysql.mysql /data/server/mysql/
#启动
cd /support-files/mysql.server
./mysql.server start
#进入mysql
cd /mysql/bin/
./mysql -uroot -p
show databases
#修改密码
alter user user() identified by "123456";
#退出
quit;
PHP
wget https://www.php.net/distributions/php-7.4.22.tar.gz
tar xzf php-7.4.22.tar.gz
cd php-7.4.22./configure --prefix=/data/server/php74 --enable-fpm --with-mysqli --with-curl --with-pdo_mysql --with-pdo_sqlite --enable-mysqlnd --enable-mbstring
//从源代码编译//编译 PHP 时需要 --enable-fpm 配置选项来激活 FPM 支持。// https://www.php.net/manual/zh/install.fpm.install.phphttps://blog.youkuaiyun.com/have_a_cat/article/details/115208121 yum install libxml2-develhttps://www.inbeijing.org/archives/2079 yum -y install sqlite-develhttps://blog.youkuaiyun.com/weixin_43930641/article/details/106198442 libcurl yum install -y libcurl-devel.x86_64https://blog.youkuaiyun.com/qq_17631419/article/details/106803807 oniguruma yum -y install oniguruma-develhttps://blog.youkuaiyun.com/shuiyuetianwy/article/details/86070213 提示没有软件包 yum install -y epel-release
make
make install
cp /data/soft/php-7.4.22/php.ini-development /data/server/php74/lib/php.ini
cp /data/server/php74/etc/php-fpm.conf.default/data/server/php74/etc/php-fpm.conf
cp /data/server/php74/etc/php-fpm.d/www.conf.default/data/server/php74/etc/php-fpm.d/www.conf
修改php.ini cgi.fix_pathinfo=0https://www.laruence.com/2010/05/20/1495.html
如果报错:
failed to open configuration file '/data/server/php7/etc/php-fpm.conf': No such file ordirectory (2)[22-Aug-202116:19:29]ERROR: failed to load configuration file '/data/server/php7/etc/php-fpm.conf'[22-Aug-202116:19:29]ERROR:FPM initialization failed
cp php74 php7
./sbin/php-fpm 启动
netstat -tnulp|grep php 查看
[bash:netstat: command not found
] yum -y install net-tools
关闭 pkill php-fpm
vim nginx.conf
server {
listen 80;
server_name localhost;#静态请求location#charset koi8-r;#access_log logs/host.access.log main;
location /{
root html;
index index.php index.html index.htm;}#动态请求处理的locatuion
location ~*.*\.(php|php7)?$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;include fastcgi.conf;}#关闭防火墙
一、防火墙的开启、关闭、禁用命令
(1)设置开机启用防火墙:systemctl enable firewalld.service
(2)设置开机禁用防火墙:systemctl disable firewalld.service
(3)启动防火墙:systemctl start firewalld
(4)关闭防火墙:systemctl stop firewalld
(5)检查防火墙状态:systemctl status firewalld