在CentOS Minimal上搭建网站,通常需要以下几个步骤:
在CentOS Minimal上,你可以选择安装Nginx或Apache作为Web服务器。以下是安装Nginx的步骤:
yum install -y gcc pcre pcre-devel zlib zlib-devel openssl openssl-devel
。wget http://nginx.org/download/nginx-1.20.1.tar.gz
(请根据实际情况下载最新版本)。tar -zxvf nginx-1.20.1.tar.gz
。cd nginx-1.20.1
。./configure --prefix=/usr/local/nginx --pid-path=/var/run/nginx.pid --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log
。make && make install
。/usr/local/nginx/conf/nginx.conf
,通常需要修改监听端口、服务器名称、日志文件路径等。/usr/local/nginx/sbin/nginx
。chkconfig nginx on
。在CentOS Minimal上,你可以选择安装MySQL或MariaDB作为数据库服务器。以下是安装MySQL的步骤:
yum install -y perl mariadb-devel
。systemctl start mariadb
。systemctl enable mariadb
。mysql_secure_installation
。/usr/local/nginx/html
或你配置的其他目录)。/usr/local/nginx/conf/conf.d/
目录下,为每个网站创建一个新的配置文件。请注意,以上步骤提供了一般性的指导,具体操作可能会因CentOS版本、具体需求或网络环境的不同而有所差异。此外,确保在进行任何配置更改后,都重新加载或重启相应的服务以使更改生效。
辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读: CentOS Stream 8容器化应用案例