Az nginx LXC-ben nem indul el, mint szerviz, de manuálisan elindítva fut CentOS 7-en.
systemctl status nginx.service -l
nginx.service - nginx - high performance web server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled)
Active: activating (start) since Wed 2014-10-01 22:10:27 UTC; 19s ago
Docs: http://nginx.org/en/docs/
Process: 2365 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS)
Process: 2364 ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS)
CGroup: /machine.slice/machine-lxc\x2dcentos\x2d7\x2dx86_64.scope/system.slice/nginx.service
├─2366 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.con
└─2367 nginx: worker process
Oct 01 22:10:27 nginx.teszt nginx[2364]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Oct 01 22:10:27 nginx.teszt nginx[2364]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Oct 01 22:10:27 nginx.teszt systemd[1]: PID file /run/nginx.pid not readable (yet?) after start.
/etc/nginx/nginx.conf tartalma:
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 128;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}
Honnan veszi a systemd, hogy a PID a /run/nginx.pid -ben van?
Pedig a conf-ban helyesen a /var/run/nginx.pid szerepel.
nginx
után szépen fut:
ps ax|grep nginx
2383 ? Ss 0:00 nginx: master process nginx
2384 ? S 0:00 nginx: worker process
De nem tudom systemctl -en keresztül kezelni.
Ez alapján raktam fel:
https://www.digitalocean.com/community/tutorials/how-to-install-nginx-o…
De már itt sem működött a konténerben:
systemctl start nginx.service
Mit nem veszek észre?
UPDATE 1:
/usr/lib/systemd/system/nginx.service állományban hibás az alap beállítás, át kell írni a PID-et...
- 3712 megtekintés
Hozzászólások
Ez a systemd nem valamilyen experimentális termék? Talán jobb lenne 'okos enged, szamár szenved' alapon eljárni:
# cd /; ln -s var/run /run
- A hozzászóláshoz be kell jelentkezni
Nem.
- A hozzászóláshoz be kell jelentkezni
Ebben a fájlban mi van: /usr/lib/systemd/system/nginx.service ?
- A hozzászóláshoz be kell jelentkezni
NevemTeve, te vagy a nap győztese! :)
[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf
ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
A PIDFile=/run/nginx.pid részt kicseréltem:
PIDFile=/var/run/nginx.pid
És most így jó.
Sakk-matt,
KaTT :)
- A hozzászóláshoz be kell jelentkezni