Alpine 系统安装应用

Alpine 系统安装应用

更换国内源

sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories

安装OpenRC

apk add openrc --no-cache

安装配置ssh

安装

apk add openssh --no-cache

修改root用户密码,修改sshd配置文件/etc/ssh/sshd_config,加入:

PermitRootLogin yes

执行以下命令:

ssh-keygen -A
rc-status
touch /run/openrc/softlevel

重启ssh

service sshd restart

将ssh加入到系统

rc-update add sshd default

此时ssh即可以访问。

安装配置Nginx

安装

apk add nginx
adduser -D -g 'www' www
mkdir /www
chown -R www:www /var/lib/nginx
chown -R www:www /www
mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.orig

修改配置文件/etc/nginx/nginx.conf

user                            www;
worker_processes                auto; # it will be determinate automatically by the number of core

error_log                       /var/log/nginx/error.log warn;
#pid                             /var/run/nginx/nginx.pid; # it permit you to use rc-service nginx reload|restart|stop|start

events {
    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;
        }
    }
}

启动系统,并加入随机启动

rc-service nginx start
rc-service nginx reload
rc-service nginx stop
rc-update add nginx default

安装配置Php-fpm

安装,系统默认为8.2版本

apk add php php-fpm
rc-service php-fpm82 start

修改配置文件/etc/nginx/nginx.conf,加入

location ~ \.php$ {
              fastcgi_pass      127.0.0.1:9000;
              fastcgi_index     index.php;
              include           fastcgi.conf;
        }

重启php-fpm

rc-service php-fpm82 restart
rc-update add php-fpm82 default
添加新评论