当前位置: 首页 > wzjs >正文

php自己做网站访问量计算做博客的seo技巧

php自己做网站访问量计算,做博客的seo技巧,设计欣赏,产品展示网站模板Linux_基础篇 欢迎来到Linux的世界,看笔记好好学多敲多打,每个人都是大神! 题目:安装部署nginx 版本号: 1.0,0 作者: 老王要学习 日期: 2025.05.02 适用环境: Centos7 文档说明 本文档聚焦于 CentOS 7 环境下 Nginx 的安装部…

Linux_基础篇

欢迎来到Linux的世界,看笔记好好学多敲多打,每个人都是大神!

题目:安装部署nginx

版本号: 1.0,0
作者: @老王要学习
日期: 2025.05.02
适用环境: Centos7

文档说明

本文档聚焦于 CentOS 7 环境下 Nginx 的安装部署。详细介绍了两种安装方法,即 yum 安装和编译安装,同时包含创建自定义配置文件、域名解析、设置开机自启等内容,还提供了一键安装脚本,为用户在 Linux 系统上搭建 Nginx 服务提供全面指导

环境准备

硬件要求

  • 服务器: 2核CPU、2GB内存,20GB硬盘空间
  • 网络: 确保服务器具有固定的IP地址,并且防火墙允许FTP端口(默认22端口)的通信

软件要求

  • 操作系统:Centos7
  • FTP软件:SecureCRT
  • 软件包:nginx

一、安装部署nginx

安装方法1:yum安装

1.0关闭防火墙

systemctl stop firewalld && systemctl disable firewalldsed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/configreboot

1.1安装epel源

#安装依赖:
yum -y install wget vim #安装epel源
wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo

1.2更新缓存

# 更新缓存
yum makecache# 查看yum仓库
yum repolist#结果如下: 
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile* base: mirrors.aliyun.com* extras: mirrors.aliyun.com* updates: mirrors.aliyun.com
源标识                   源名称                                                 状态
base/7/x86_64            CentOS-7 - Base - mirrors.aliyun.com                   10,072
epel/x86_64              Extra Packages for Enterprise Linux 7 - x86_64         13,791
extras/7/x86_64          CentOS-7 - Extras - mirrors.aliyun.com                    526
updates/7/x86_64         CentOS-7 - Updates - mirrors.aliyun.com                 6,173
repolist: 30,562

1.3进入yum.repos.d编写配置文件

cat>/etc/yum.repos.d/nginx.repo<<EOF
[nginx-stable]name=nginx stable repobaseurl=http://nginx.org/packages/centos/$releasever/$basearch/gpgcheck=1enabled=1gpgkey=https://nginx.org/keys/nginx_signing.keymodule_hotfixes=true
EOF

1.4安装

# 重新建立缓存
yum makecache# 安装nginx
yum install nginx

安装方法2:编译安装

1.1安装依赖包

yum -y install pcre-devel openssl-devel zlib-devel

1.2下载安装包

# 下载nginx包
wget https://nginx.org/download/nginx-1.26.3.tar.gz -c  /usr/local/src/# 解压安装包
tar zxf /usr/local/src/nginx-1.26.3.tar.gz

1.3创建用户

groupadd -r wwwuseradd -g www -M -s /bin/false -r wwwid www

1.4编译安装

#编译
cd /usr/local/src/nginx-1.26.3./configure --prefix=/usr/local/nginx/#安装
make && make install

1.5启动nginx

/usr/local/nginx/sbin/nginxss -antpl | grep nginx
#结果如下: 
LISTEN     0      128          *:80                       *:*                   users:(("nginx",pid=10790,fd=6),("nginx",pid=10789,fd=6))

1.6网页测试

curl localhost#结果如下: 
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p><p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p><p><em>Thank you for using nginx.</em></p>
</body>
</html>

二、创建自己的配置文件

2.1创建配置文件

# 停止nginx
/usr/local/nginx/sbin/nginx -s stop# 写入配置文件
cat>/usr/local/nginx/conf/mynginx.conf<<EOF
events {}http {server {location / {root html1;}}
}
EOF

2.2创建web01

#创建网页lw01目录
mkdir /usr/local/nginx/html1/#写入内容
echo "my nginx web01" > /usr/local/nginx/html1/index.html#启动服务
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/mynginx.conf#访问测试
curl localhost

2.3创建web02

#停止nginx服务
/usr/local/nginx/sbin/nginx -s stop#创建web02目录
mkdir /usr/local/nginx/html2#写入数据
echo "mynginx web02" > /usr/local/nginx/html2/index.html#修改配置文件
cat > /usr/local/nginx/conf/nginx.conf <<EOF
events {}
http {server {listen 80;server_name www.web1.com;location / {root html1;}}server {listen 80;server_name www.web2.com;location / {root html2;}}
}
EOF

2.4域名解析

#追加内容到hosts文件
cat>>/etc/hosts<<EOF
192.168.8.10 www.web1.com
192.168.8.10 www.web2.com
EOF#启动服务
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/mynginx.conf#访问测试
curl www.web1.comcurl www.web2.com

三、开机自启动

/usr/local/nginx/sbin/nginx -s stopcat>/usr/lib/systemd/system/nginx.service<<EOF[Unit]Description=Web server daemonAfter=network.target[Service]Type=forlingEnvironmentFile=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.confKillMode=process[Install]WantedBy=multi-user.target
EOF#重启服务 
systemctl daemon-reloadsystemctl start nginxsystemctl enable nginx

四、编写一键安装脚本

4.1关闭防火墙

systemctl stop firewalld && systemctl disable firewalldsed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/configreboot

4.2一键安装脚本

#!/bin/bash#下载nginx进行安装#安装开发软件yum -y install pcre-devel openssl-devel zlib-devel#下载nginx包cd /usr/local/src/wget https://nginx.org/download/nginx-1.26.3.tar.gztar zxf nginx-1.26.3.tar.gz#创建一个系统用户组groupadd -r wwwuseradd -g www -M -s /bin/false -r wwwid www#添加模块cd /usr/src/nginx-1.26.3/./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_v2_module --with-http_addition_module --with-http_sub_module  --with-http_flv_module  --with-http_random_index_module  --with-http_stub_status_module#源码编译make && make install#停止nginx/usr/local/nginx/sbin/nginx -s stopcat > /usr/local/nginx/conf/nginx.conf <<EOFevents {}http{server {location / {root html1;}}}EOFmkdir /usr/local/nginx/html1/echo "my nginx web01" > /usr/local/nginx/html1/index.html/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/mynginx.confcurl localhost#创建web02/usr/local/nginx/sbin/nginx -s stopmkdir /usr/local/nginx/html2echo "mynginx web02" > /usr/local/nginx/html2/index.htmlcat > /usr/local/nginx/conf/nginx.conf <<EOFevents {}http {server {listen 80;server_name www.web1.com;location / {root html1;}}server {listen 80;server_name www.web2.com;location / {root html2;}}}EOF#域名解析echo "192.168.8.10 www.web1.com192.168.8.10 www.web1.com" >>  /etc/hosts/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/mynginx.confcurl www.web1.comcurl www.web2.com#开机自启/usr/local/nginx/sbin/nginx -s stopcd /usr/lib/systemd/systemcp sshd.service nginx.servicecat > nginx.service <<EOF[Unit]Description=Web server daemonAfter=network.target[Service]Type=forlingEnvironmentFile=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.confKillMode=process[Install]WantedBy=multi-user.targetEOFsystemctl daemon-reloadsystemctl start nginxsystemctl enable nginx

文章转载自:

http://PJ3k6VVH.fdLyh.cn
http://hqgVhIOC.fdLyh.cn
http://El7YDtcc.fdLyh.cn
http://fP9fXTsG.fdLyh.cn
http://OCHT55Wx.fdLyh.cn
http://F6r1dnuu.fdLyh.cn
http://seqxV77k.fdLyh.cn
http://oEckZJ1l.fdLyh.cn
http://JUGxmYqI.fdLyh.cn
http://C1jiaUBj.fdLyh.cn
http://B8KMxB9P.fdLyh.cn
http://LaBjkm2y.fdLyh.cn
http://8OQWQ9LB.fdLyh.cn
http://ynwG2jIY.fdLyh.cn
http://tiU6U4kL.fdLyh.cn
http://IIsQ6dLY.fdLyh.cn
http://8dWJYcr4.fdLyh.cn
http://PRIstEsQ.fdLyh.cn
http://yPS9a6Nq.fdLyh.cn
http://67pzwcr3.fdLyh.cn
http://ehEmj62S.fdLyh.cn
http://ZmgpAQiV.fdLyh.cn
http://g11FN3nA.fdLyh.cn
http://csD9slVO.fdLyh.cn
http://WGZ9ei0f.fdLyh.cn
http://Wz1arFc4.fdLyh.cn
http://Mb8EVC43.fdLyh.cn
http://hQy3rtlQ.fdLyh.cn
http://OFbDOGcT.fdLyh.cn
http://3U7joYyd.fdLyh.cn
http://www.dtcms.com/wzjs/716313.html

相关文章:

  • 企业做网站公司哪家好wordpress nginx配置文件
  • 国内大型游戏外包公司seo外链网站
  • 周口网站制作网上做兼职的网站
  • 医院预约挂号系统网站开发方案微商如何引流与推广
  • 发布企业信息的网站商业网站的特点
  • 云系统网站建设合同网站建设公司新报价
  • 网站名称图标如何做才能显示建站是什么专业
  • 织梦dedecms教育培训网站模板国外vps做网站测速
  • 如何在税局网站上做税种认定湛江哪个论坛人气多
  • 搭建网站seo福田网站建设罗湖网站建设
  • 网站制作进度表抖音搜索排名
  • 免费不良正能量网站链接布吉网站设计
  • 学广告设计要学多久无锡seo管理
  • 学生自做网站优秀作品crm排名
  • 品牌网站建设 51下拉wordpress调用自定义文章类型
  • dedecms能做什么网站如何使用网络营销策略
  • 龙南网站建设宁夏建设厅网站6
  • 企业网站内容如何更新营销型网站的概念
  • 教育门户网站建设方案域名注册需要多久
  • 做家居商城网站爱站工具包如何增加网站
  • 大型网站权限设计百度排名点击软件
  • 网站建设续约合同重庆市建设安全管理网
  • 做网站 信科网络南康网站建设公司
  • 东莞建外贸企业网站网站做百度排名教程
  • 米客优品的网站是哪做的微官网制作一般多少钱
  • 建网站添加付款方式wordpress主题yeti1.9.2
  • 淘宝联盟怎么做自己的网站深圳住房建设部官方网站
  • 做网站像素大小企业网站的cms
  • 网站建设帝国如何建微信公众号平台
  • 一般网站模块wordpress菜单下拉菜单