liunx 的 centos7 安装nginx
1、执行下面命令
bash
sudo yum install -y nginx
等着下载安装就完了

2、我TM直接关闭防火墙
bash
sudo systemctl stop firewalld
推荐做法还是开80这个端口就行
bash
sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
3、修改nginx配置
a、nginx配置文件在 /etc/nginx 文件夹里面的nginx.conf。
b、资源页面在 /usr/share/nginx/html 文件夹里面,里面有index.html、404.html等页面资源
先修改nginx.conf配置文件,增加下面红框这一行代码就行。

bash
# 添加下面这一行,指定默认首页文件
index index.html index.htm;
4、然后重新启动一下nginx,刷新一下nginx的配置。通过服务器IP地址即可访问网站了。
bash
sudo systemctl start nginx
5、当你觉得默认的nginx很难看,你就可以改下/usr/share/nginx/html 里面的index.html页面。建议你把下面的html代码复制到index.html页面里面去(原来index.html的代码一行都不要)
bash
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>NEXUS | 下一代前端解决方案</title>
<style>
/* --- 基础重置 --- */
:root {
--bg-color: #0a0a0a;
--text-main: #ffffff;
--text-muted: #888888;
--primary-gradient: linear-gradient(135deg, #4361ee, #3a0ca3);
--accent-color: #4cc9f0;
--card-bg: rgba(255, 255, 255, 0.03);
--border-color: rgba(255, 255, 255, 0.1);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
background-color: var(--bg-color);
color: var(--text-main);
line-height: 1.6;
overflow-x: hidden;
}
a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; }
/* --- 导航栏 --- */
header {
position: fixed;
top: 0;
width: 100%;
padding: 20px 5%;
display: flex;
justify-content: space-between;
align-items: center;
background: rgba(10, 10, 10, 0.8);
backdrop-filter: blur(10px);
z-index: 1000;
border-bottom: 1px solid var(--border-color);
}
.logo {
font-size: 1.5rem;
font-weight: 800;
letter-spacing: -1px;
background: var(--primary-gradient);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
nav ul {
display: flex;
gap: 30px;
}
nav a:hover {
color: var(--accent-color);
}
.cta-btn {
padding: 10px 24px;
background: var(--text-main);
color: var(--bg-color);
border-radius: 50px;
font-weight: 600;
font-size: 0.9rem;
}
.cta-btn:hover {
background: var(--accent-color);
transform: translateY(-2px);
}
/* --- 英雄区域 (Hero) --- */
.hero {
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
padding: 0 20px;
position: relative;
overflow: hidden;
}
/* 背景动态光球 (CSS绘图) */
.orb {
position: absolute;
border-radius: 50%;
filter: blur(80px);
opacity: 0.6;
z-index: -1;
animation: float 10s infinite ease-in-out;
}
.orb-1 { width: 300px; height: 300px; background: #4361ee; top: 20%; left: 20%; }
.orb-2 { width: 400px; height: 400px; background: #7209b7; bottom: 10%; right: 10%; animation-delay: 2s; }
@keyframes float {
0%, 100% { transform: translate(0, 0); }
50% { transform: translate(30px, -50px); }
}
.hero h1 {
font-size: clamp(3rem, 8vw, 5rem);
font-weight: 900;
line-height: 1.1;
margin-bottom: 20px;
letter-spacing: -2px;
}
.hero h1 span {
background: linear-gradient(to right, #4cc9f0, #4361ee);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.hero p {
font-size: 1.2rem;
color: var(--text-muted);
max-width: 600px;
margin-bottom: 40px;
}
.hero-btns {
display: flex;
gap: 20px;
}
.btn-outline {
padding: 12px 30px;
border: 1px solid var(--border-color);
border-radius: 50px;
background: transparent;
color: var(--text-main);
}
.btn-outline:hover {
border-color: var(--accent-color);
background: rgba(76, 201, 240, 0.1);
}
/* --- 代码展示区 --- */
.code-showcase {
width: 100%;
max-width: 800px;
margin: -50px auto 0;
background: #1e1e1e;
border-radius: 12px;
padding: 20px;
box-shadow: 0 20px 50px rgba(0,0,0,0.5);
border: 1px solid var(--border-color);
font-family: 'Fira Code', monospace;
position: relative;
z-index: 10;
}
.code-header {
display: flex;
gap: 8px;
margin-bottom: 15px;
}
.dot { width: 12px; height: 12px; border-radius: 50%; }
.red { background: #ff5f56; }
.yellow { background: #ffbd2e; }
.green { background: #27c93f; }
.code-content {
color: #d4d4d4;
font-size: 0.9rem;
}
.keyword { color: #c586c0; }
.string { color: #ce9178; }
.func { color: #dcdcaa; }
/* --- 服务网格 --- */
.services {
padding: 100px 5%;
}
.section-header {
text-align: center;
margin-bottom: 60px;
}
.section-header h2 {
font-size: 2.5rem;
margin-bottom: 10px;
}
.grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 30px;
}
.card {
background: var(--card-bg);
border: 1px solid var(--border-color);
padding: 40px;
border-radius: 16px;
transition: 0.3s;
position: relative;
overflow: hidden;
}
.card:hover {
transform: translateY(-10px);
border-color: var(--accent-color);
background: rgba(255, 255, 255, 0.05);
}
/* CSS 绘图图标 */
.icon-box {
width: 50px;
height: 50px;
margin-bottom: 20px;
background: var(--primary-gradient);
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
font-size: 1.5rem;
font-weight: bold;
color: white;
}
.card h3 { margin-bottom: 15px; font-size: 1.5rem; }
.card p { color: var(--text-muted); }
/* --- 数据展示 --- */
.stats {
padding: 80px 5%;
background: linear-gradient(180deg, var(--bg-color), #111);
display: flex;
justify-content: space-around;
flex-wrap: wrap;
text-align: center;
gap: 40px;
}
.stat-item h3 {
font-size: 3rem;
color: var(--accent-color);
margin-bottom: 10px;
}
.stat-item p { color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; font-size: 0.9rem; }
/* --- 页脚 --- */
footer {
padding: 60px 5%;
border-top: 1px solid var(--border-color);
text-align: center;
color: var(--text-muted);
}
.footer-logo {
font-size: 1.5rem;
font-weight: bold;
color: var(--text-main);
margin-bottom: 20px;
display: inline-block;
}
@media (max-width: 768px) {
nav { display: none; }
.hero h1 { font-size: 2.5rem; }
.stats { flex-direction: column; }
}
</style>
</head>
<body>
<!-- 导航栏 -->
<header>
<div class="logo">NEXUS.</div>
<nav>
<ul>
<li><a href="#">首页</a></li>
<li><a href="#">服务</a></li>
<li><a href="#">案例</a></li>
<li><a href="#">关于我们</a></li>
</ul>
</nav>
<a href="#" class="cta-btn">联系我们</a>
</header>
<!-- 英雄区域 -->
<section class="hero">
<!-- 纯CSS背景装饰 -->
<div class="orb orb-1"></div>
<div class="orb orb-2"></div>
<h1>构建代码世界的<br><span>极致体验</span></h1>
<p>我们不只是写代码,我们构建世界。专注于高性能、响应式和可访问的前端架构设计。</p>
<div class="hero-btns">
<a href="#" class="cta-btn">开始项目</a>
<a href="#" class="btn-outline">查看文档</a>
</div>
</section>
<!-- 代码展示 (替代图片) -->
<div class="code-showcase">
<div class="code-header">
<div class="dot red"></div>
<div class="dot yellow"></div>
<div class="dot green"></div>
</div>
<div class="code-content">
<p><span class="keyword">const</span> <span class="func">createFuture</span> = () => {</p>
<p> <span class="keyword">return</span> {</p>
<p> performance: <span class="string">'100/100'</span>,</p>
<p> accessibility: <span class="string">'AAA'</span>,</p>
<p> design: <span class="string">'Pixel Perfect'</span></p>
<p> };</p>
<p>};</p>
</div>
</div>
<!-- 服务区域 -->
<section class="services">
<div class="section-header">
<h2>我们的专长</h2>
<p style="color: var(--text-muted);">用技术驱动业务增长</p>
</div>
<div class="grid">
<!-- 卡片 1 -->
<div class="card">
<div class="icon-box">⚡</div>
<h3>高性能开发</h3>
<p>基于 React, Vue 和 Next.js 构建秒级加载的单页应用,优化核心 Web 指标。</p>
</div>
<!-- 卡片 2 -->
<div class="card">
<div class="icon-box">🎨</div>
<h3>创意交互</h3>
<p>利用 WebGL 和 CSS3 动画,打造令人惊叹的视觉体验和流畅的用户界面。</p>
</div>
<!-- 卡片 3 -->
<div class="card">
<div class="icon-box">📱</div>
<h3>全端适配</h3>
<p>移动优先的开发策略,确保您的产品在从手机到 4K 屏幕的任何设备上完美运行。</p>
</div>
</div>
</section>
<!-- 数据统计 -->
<section class="stats">
<div class="stat-item">
<h3>50+</h3>
<p>企业级项目</p>
</div>
<div class="stat-item">
<h3>99%</h3>
<p>客户满意度</p>
</div>
<div class="stat-item">
<h3>5年</h3>
<p>行业经验</p>
</div>
</section>
<!-- 页脚 -->
<footer>
<div class="footer-logo">张三爱李四</div>
<p>© 2026 张三爱李四 前端工作室。保留所有权利。.</p>
<p style="margin-top: 10px; font-size: 0.8rem;">纯纯AI代码</p>
</footer>
</body>
</html>