{"id":227,"date":"2019-12-02T05:14:22","date_gmt":"2019-12-02T05:14:22","guid":{"rendered":"http:\/\/cloudygeek.com\/?p=227"},"modified":"2024-04-16T20:55:46","modified_gmt":"2024-04-16T20:55:46","slug":"nginx-fails","status":"publish","type":"post","link":"https:\/\/cloudygeek.com\/?p=227","title":{"rendered":"Nginx (v1.17.6) fails to start in CentOS7"},"content":{"rendered":"\n<p>I am posting this here as a reminder that Centos7 has a weird systemD bug with Nginx<\/p>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<p><strong>SYMPTOMS:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">   1) Nginx restart fails after a yum update \n   2) Error:    \n      \n      [root@centos7VM user]# systemctl status nginx.service\n      nginx.service - nginx - high performance web server\n         Loaded: loaded (\/etc\/systemd\/system\/nginx.service; enabled; vendor preset: disabled)\n         Active: failed (Result: timeout) since Sun 2019-12-01 21:19:26 MST; 1min 21s ago\n              Docs: http:\/\/nginx.org\/en\/docs\/\n         Process: 820 ExecStart=\/usr\/sbin\/nginx -c \/etc\/nginx\/nginx.conf (code=exited, status=0\/SUCCESS)\n      Dec 01 11:16:00 servername nginx[842]: nginx: the configuration file \/etc\/nginx\/nginx.c\u2026 ok<\/pre>\n<\/div><\/div>\n\n\n\n<!--more-->\n\n\n\n<p><strong>FIX:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">1) <strong>Modify the file<\/strong>\n\n\/usr\/lib\/systemd\/system\/nginx.service\n\n2) <strong>File should look like:<\/strong>\n\n[Unit]\n Description=The NGINX HTTP and reverse proxy server\n After=syslog.target network.target remote-fs.target nss-lookup.target\n\n [Service]\n Type=forking\n PIDFile=\/run\/nginx.pid\n ExecStartPre=\/usr\/sbin\/nginx -t\n ExecStart=\/usr\/sbin\/nginx\n ExecReload=\/bin\/kill -s HUP $MAINPID\n ExecStop=\/bin\/kill -s QUIT $MAINPID\n PrivateTmp=true\n\n [Install]\n WantedBy=multi-user.target\n\n<\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am posting this here as a reminder that Centos7 has a weird systemD bug with Nginx SYMPTOMS: 1) Nginx restart fails after a yum update 2) Error: [root@centos7VM user]# systemctl status nginx.service nginx.service &#8211; nginx &#8211; high performance web server Loaded: loaded (\/etc\/systemd\/system\/nginx.service; enabled; vendor preset: disabled) Active: failed (Result: timeout) since Sun 2019-12-01 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/cloudygeek.com\/?p=227\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Nginx (v1.17.6) fails to start in CentOS7&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/cloudygeek.com\/index.php?rest_route=\/wp\/v2\/posts\/227"}],"collection":[{"href":"https:\/\/cloudygeek.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudygeek.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudygeek.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudygeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=227"}],"version-history":[{"count":17,"href":"https:\/\/cloudygeek.com\/index.php?rest_route=\/wp\/v2\/posts\/227\/revisions"}],"predecessor-version":[{"id":262,"href":"https:\/\/cloudygeek.com\/index.php?rest_route=\/wp\/v2\/posts\/227\/revisions\/262"}],"wp:attachment":[{"href":"https:\/\/cloudygeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=227"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudygeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=227"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudygeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=227"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}