已经在alpine上安装过,caddy、lighttp。
今天来点新鲜的,nginx。看看那个占用的内存低。
首先安装nginx,alpine 安装东西就是方便。
apk add nginx
为nginx创建新用户www
adduser -D -g 'www' www
创建网站根目录
mkdir /www
chown -R www:www /var/lib/nginx
chown -R www:www /www
配置nginx
先备份
mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.orig
编辑
vi /etc/nginx/nginx.conf
参考配置
user www;
worker_processes auto; # it will be determinate automatically by the >number of coreerror_log /var/log/nginx/error.log warn;
#pid /var/run/nginx.pid; # it permit you to use >/etc/init.d/nginx >reload|restart|stop|startevents {
worker_connections 1024;
}http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
access_log /var/log/nginx/access.log;
keepalive_timeout 3000;
server {listen 80; root /www; index index.html index.htm; server_name localhost; client_max_body_size 32m; error_page 500 502 503 504 /50x.html; location = /50x.html { root /var/lib/nginx/html; }}
}
一些控制Nginx的命令:
rc-service nginx start
rc-service nginx reload
rc-service nginx restart
rc-service nginx stop
如有错误可以在less /var/log/nginx/error.log查看错误日志。
这样web服务端算是安装好了。明天我们再来配置下php。