nginx加入开机启动

cat <<EOF >> /etc/systemd/system/nginx.service
> [Unit]
> Description=nginx – high performance web server
> After=network.target remote-fs.target nss-lookup.target
>
> [Service]
> Type=forking
> ExecStart=$NGINX_HOME/sbin/nginx -c $NGINX_HOME/conf/nginx.conf
> ExecReload=$NGINX_HOME/sbin/nginx -s reload
> ExecStop=$NGINX_HOME/sbin/nginx -s stop
>
> [Install]
> WantedBy=multi-user.target
> EOF

systemctl daemon-reload

systemctl start nginx

systemctl enable nginx

 

redis加入开机启动

cat << EOF >> /etc/systemd/system/redis.service
> [Unit]
> Description=Redis Server Manager
> After=syslog.target
> After=network.target
>
> [Service]
> Type=forking
> PIDFile=/home/redis4.0.9/redis_6379.pid
> ExecStart=/home/redis4.0.9/src/redis-server /home/redis4.0.9/redis.conf
> ExecStop=/home/redis4.0.9/src/redis-cli shutdown
> Restart=always
>
> [Install]
> WantedBy=multi-user.target
> EOF

systemctl daemon-reload

systemctl start redis

systemctl enable redis

 

版权声明:本文为LAlexH原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/LAlexH/p/12015389.html