在CentOS Minimal上部署Web服务器,你可以选择多种Web服务器软件,如Apache、Nginx等。以下是使用Apache和Nginx作为Web服务器的部署步骤:
安装Apache:
sudo yum install httpd
启动Apache服务:
sudo systemctl start httpd
设置Apache开机自启动:
sudo systemctl enable httpd
配置防火墙(如果需要):
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload
配置Apache(可选):
/etc/httpd/conf/httpd.conf
文件,根据需要进行配置。/etc/httpd/conf.d/
目录下的配置文件。测试Apache: 打开浏览器,访问服务器的IP地址或域名,应该能看到Apache的默认页面。
安装Nginx:
sudo yum install nginx
启动Nginx服务:
sudo systemctl start nginx
设置Nginx开机自启动:
sudo systemctl enable nginx
配置防火墙(如果需要):
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload
配置Nginx:
/etc/nginx/nginx.conf
文件,根据需要进行配置。/etc/nginx/conf.d/
目录下的配置文件。测试Nginx: 打开浏览器,访问服务器的IP地址或域名,应该能看到Nginx的默认页面。
通过以上步骤,你可以在CentOS Minimal上成功部署一个Web服务器。根据你的需求选择合适的Web服务器软件,并进行相应的配置。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读:CentOS Minimal适合哪些场景