Nginx安装 Web服务器软件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 # 下载Nginx # wget http://nginx.org/download/nginx-1.21.4.tar.gz --2021-11-19 00:42:27-- http://nginx.org/download/nginx-1.21.4.tar.gz Resolving nginx.org (nginx.org)... 3.125.197.172, 2a05:d014:edb:5704::6, 2a05:d014:edb:5702::6 Connecting to nginx.org (nginx.org)|3.125.197.172|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 1070260 (1.0M) [application/octet-stream] Saving to: ‘nginx-1.21.4.tar.gz’ nginx-1.21.4.tar.gz 100%[=====================================================================================================================>] 1.02M 254KB/s in 4.1s 2021-11-19 00:42:32 (254 KB/s) - ‘nginx-1.21.4.tar.gz’ saved [1070260/1070260] # 安装依赖 # yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel # 解压 # tar -zxf nginx-1.21.4.tar.gz # 进人Nginx主目录 # cd nginx-1.21.4# 执行命令 # ./configure # make # make install # 启动 # 检查配置文件 # /usr/local/nginx/sbin/nginx -t # 启动 # /usr/local/nginx/sbin/nginx # 重启加载配置 # /usr/local/nginx/sbin/nginx -s reload # 测试 [root@localhost nginx-1.21.4]# wget 192.168.111.128 --2021-11-19 00:50:19-- http://192.168.111.128/ Connecting to 192.168.111.128:80... connected. HTTP request sent, awaiting response... 200 OK Length: 615 [text/html] Saving to: ‘index.html’ index.html 100%[=====================================================================================================================>] 615 --.-KB/s in 0s 2021-11-19 00:50:19 (107 MB/s) - ‘index.html’ saved [615/615] # 为了可以外部访问,关闭防火墙,或者放开80端口 # 查看防火墙状态 [root@localhost nginx-1.21.4]# systemctl status firewalld ● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2021-11-18 21:03:13 PST; 4h 42min ago Docs: man:firewalld(1) Main PID: 1029 (firewalld) Tasks: 2 (limit: 4771) Memory: 812.0K CGroup: /system.slice/firewalld.service └─1029 /usr/libexec/platform-python -s /usr/sbin/firewalld --nofork --nopid Nov 18 21:03:12 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon... Nov 18 21:03:13 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon. Nov 18 21:03:13 localhost.localdomain firewalld[1029]: WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration option. It will be removed in a future release. Please consider disabli> # 关闭防火墙 [root@localhost nginx-1.21.4]# systemctl stop firewalld
welcome.html 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 <!DOCTYPE html > <html lang ="zh-CN" > <head > <meta charset ="UTF-8" > <meta name ="viewport" content ="width=device-width, initial-scale=1.0" > <title > 欢迎来到我的网页</title > <style > body { font-family : Arial, sans-serif; text-align : center; margin-top : 20% ; background-color : #f2f2f2 ; } h1 { color : #333 ; } </style > </head > <body > <h1 > 欢迎来到我的网页!</h1 > <p > 这是一个简单的欢迎网页示例。</p > <p > 你可以在这里添加更多的内容,比如图片、链接、文本等。</p > </body > </html >
https://www.ctyun.cn/
140.246.94.37
天翼云: 这些端口8080,80,443,8443 需要备案后才能访问。
修改NGINX服务端口为8081,并在安全组中加入入方向规则
Redis安装 redis安装 1 2 3 4 5 6 7 8 9 10 cd /home/root2/myroottar -zxvf redis-6.2.20.tar.gz -C /opt mv /opt/redis-6.2.20 /opt/redissudo yum install gcc-c++cd /opt/redismake cd /opt/redis/srcsudo make install/opt/redis/src/redis-server
配置后台启动 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 vim /opt/redis/redis.conf 输入/daemonize查找daemonize no 将 “aemonize no” 修改为 “aemonize yes ” :wq保存退出 /opt/redis/src/redis-server /opt/redis/redis.conf /opt/redis/src/redis-cli 关闭redis /opt/redis/src/redis-cli shutdown sudo cp /opt/redis/redis.service /etc/systemd/system/redis.servicesudo systemctl daemon-reloadsudo systemctl start redis.servicesudo systemctl enable redis.service