在CentOS Stream 8上,以下是一些推薦的開發工具及其安裝方法:
sudo dnf groupinstall "Development Tools"
sudo dnf install pcre-devel zlib-devel openssl-devel
wget https://downloads.apache.org/httpd/httpd-2.4.48.tar.gz
tar -zxvf httpd-2.4.48.tar.gz
cd httpd-2.4.48
./configure --prefix=/usr/local/apache --with-mpm-event --enable-so --enable-rewrite
make
sudo make install
sudo /usr/local/apache/bin/apachectl start
sudo vi /etc/systemd/system/httpd.service
在文件中添加以下內容:
[Unit]
Description=The Apache HTTP Server
After=network.target
[Service]
ExecStart=/usr/local/apache/bin/apachectl start
ExecReload=/usr/local/apache/bin/apachectl graceful
ExecStop=/usr/local/apache/bin/apachectl stop
[Install]
WantedBy=multi-user.target
保存并關閉文件,然后運行以下命令啟用Apache服務:
sudo systemctl enable httpd
wget http://nginx.org/download/nginx-1.22.0.tar.gz
tar -zxvf nginx-1.22.0.tar.gz
cd nginx-1.22.0
./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_v2_module
make
sudo make install
sudo /usr/local/nginx/sbin/nginx
sudo vi /etc/systemd/system/nginx.service
在文件中添加以下內容:
[Unit]
Description=The nginx HTTP and reverse proxy server
After=network.target
[Service]
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s stop
[Install]
WantedBy=multi-user.target
保存并關閉文件,然后運行以下命令啟用Nginx服務:
sudo systemctl enable nginx
以上是在CentOS Stream 8系統上安裝和配置Apache和Nginx的基本教程。這些步驟可以幫助您在CentOS Stream 8上進行Web開發。請注意,具體的配置和參數可能因您的需求而有所不同,您可以根據自己的情況進行調整。