在Gentoo上安装Nginx

gentoo_nginx.png

在 /etc/portage/make.conf 中添加以下内容

(省略)
NGINX_MODULES_HTTP="fastcgi gzip"

2)安装Nginx。

sudo emerge --ask www-servers/nginx

3) 编辑 /etc/nginx/nginx.conf

(省略)
server {
       listen 80 default_server;
       root /var/www/localhost/htdocs;

(省略)

4) 创建 /var/www/localhost/htdocs/index.html。

<!DOCTYPE html>
<html lang="ja">
<head>
<meta http-equiv="CONTENT-TYPE" content="text/html; charset=utf-8" />
<head>
Test
</head>
<body>
Hello, world!<p />
Oct/13/2020<p />
</body>
</html>

5) 确认Nginx配置是否正确。

sudo nginx -t

6) 启动 Nginx。

sudo rc-service nginx start

7) 使用curl从内部访问

curl http://localhost

在浏览器上访问

http://gentoo.local 可以用中文翻譯為「本地gentoo」。

bannerAds