nginx
准备
一台Centos服务器IP:192.168.200.15
关闭防火墙、关闭SELinux、配置yum源
nginx安装
nginx官网地址:nginx: download
这两个随便下载一个,传到你的服务器上
yum这几个包
[root@nginx ~]# yum -y install pcre-devel openssl openssl-devel gcc gcc-c++
开启nginx
[root@nginx ~]# ll
总用量 1056
-rw-------. 1 root root 1311 12月 20 22:36 anaconda-ks.cfg
-rw-r--r-- 1 root root 1073364 2月 28 17:32 nginx-1.21.6.tar.gz
[root@nginx ~]# tar -zxvf nginx-1.21.6.tar.gz
[root@nginx ~]# cd nginx-1.21.6
[root@nginx nginx-1.21.6]# ./configure
[root@nginx nginx-1.21.6]# make && make install
[root@nginx nginx-1.21.6]# cd /usr/local/nginx/objs/
[root@nginx objs]# ./nginx
[root@nginx objs]# netstat -lntp |grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 4539/nginx: master
访问服务器
用浏览器访问服务器,然后是这样的话,那么你成功了。 192.168.200.15:80端口
【快捷小妙招】 修改nginx配置文件,使可以直接开启关闭nginx
[root@masker ~]# vim /etc/profile
#最后一行添加这个
export PATH=/usr/local/nginx/objs:$PATH
[root@masker ~]# source /etc/profile #刷新配置文件
【修改html文件】html文件都懂吧
[root@masker ~]# vim /usr/local/nginx/html/index.html
[root@masker ~]# nginx //直接开启nginx
[root@masker ~]# nginx -s stop //关闭nginx
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 零经验选手,Compose 一天开发一款小游戏!
· 一起来玩mcp_server_sqlite,让AI帮你做增删改查!!