sudo cat /etc/issue
可以看到操作系統(tǒng)的版本是Ubuntu 20.04.4 LTS
,sudo lsb_release -r
可以看到版本是20.04
,sudo uname -r
可以看到內(nèi)核版本是5.5.19
,sudo make -v
可以看到版本是GNU Make 4.2.1
。
需要先參考我的博客《Linux學(xué)習(xí)之Ubuntu 20.04在https://openresty.org下載源碼安裝Openresty 1.19.3.1,使用systemd管理OpenResty服務(wù)》安裝好Openresty
。
在/usr/lib/systemd/system
目錄下創(chuàng)建一個openresty.service
文件,文件內(nèi)容如下:
[Unit]
Description=The OpenResty Application
After=syslog.target network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
Type=forking
PIDFile=/usr/local/openresty/nginx/logs/nginx.pid
ExecStartPre=/usr/local/openresty/nginx/sbin/nginx -t -q -g 'daemon on; master_process on;'
ExecStart=/usr/local/openresty/nginx/sbin/nginx -g 'daemon on; master_process on;'
ExecReload=/usr/local/openresty/nginx/sbin/nginx -g 'daemon on; master_process on;' -s reload
ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /usr/local/openresty/nginx/logs/nginx.pid
TimeoutStopSec=5
KillMode=mixed
[Install]
WantedBy=multi-user.target
sudo systemctl enable openresty
設(shè)置自啟動,sudo systemctl start openresty
啟動openresty
,sudo systemctl status openresty
查看到狀態(tài)是active (running)
。
在瀏覽器里邊輸入服務(wù)器ip,要是正常配置好的話,顯示如下:文章來源:http://www.zghlxwxcb.cn/news/detail-675993.html
此文章為8月Day 26學(xué)習(xí)筆記,內(nèi)容來源于極客時間《Linux 實戰(zhàn)技能 100 講》。文章來源地址http://www.zghlxwxcb.cn/news/detail-675993.html
到了這里,關(guān)于Linux學(xué)習(xí)之Ubuntu 20使用systemd管理OpenResty服務(wù)的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!