title: manual start nginx ,it ok with static html, but use systemctl start nginx, it's 403
body: <p><code>nginx version: nginx/1.19.0</code></p>
  <p>My nginx conf is <code>/etc/nginx/nginx.conf</code></p>
  <pre><code>user  root;
  worker_processes  1;
  
  error_log  /var/log/nginx/error.log warn;
  pid        /var/run/nginx.pid;
  
  
  events {
      worker_connections  1024;
  }
  
  http {
      include       /etc/nginx/mime.types;
      default_type  application/octet-stream;
  
      log_format  main  '$remote_addr - $remote_user [$time_local] &quot;$request&quot; ' '$status $body_bytes_sent &quot;$http_referer&quot; ' '&quot;$http_user_agent&quot; &quot;$http_x_forwarded_for&quot;'  ' query_string=$query_string' ' port=$upstream_http_port' ' b=$arg_b';
  
      access_log  /var/log/nginx/access.log  main;
  
      sendfile        on;
      #tcp_nopush     on;
  
      keepalive_timeout  65;
  
      #gzip  on;
  
      include /etc/nginx/conf.d/*.conf;
      server {
            listen 10001;
            server_name test1;
            location / {
               root /home/static/;
               index index.html;
            }
        }
  
  }
  </code></pre>
  <p>my html file is</p>
  <pre class="lang-sh prettyprint-override"><code>$ cat /home/static/index.html
  hello
  
  </code></pre>
  <pre class="lang-sh prettyprint-override"><code>-rw-r--r--. 1 root root 6 2021-10-07 05:38:24 static/index.html
  </code></pre>
  <p>when I start nginx manual,it's work .</p>
  <pre class="lang-sh prettyprint-override"><code>$ nginx &amp;&amp; curl localhost:10001
  hello
  </code></pre>
  <p>but when I start by systemctl</p>
  <pre class="lang-sh prettyprint-override"><code>$ systemctl start nginx &amp;&amp; curl localhost:10001
  &lt;html&gt;
  &lt;head&gt;&lt;title&gt;403 Forbidden&lt;/title&gt;&lt;/head&gt;
  &lt;body&gt;
  &lt;center&gt;&lt;h1&gt;403 Forbidden&lt;/h1&gt;&lt;/center&gt;
  &lt;hr&gt;&lt;center&gt;nginx/1.19.0&lt;/center&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>the nginx.service status like this</p>
  <pre class="lang-sh prettyprint-override"><code>$ systemctl status nginx
  ● nginx.service - nginx - high performance web server
     Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
     Active: active (running) since Thu 2021-10-07 07:34:00 CST; 1min 23s ago
       Docs: http://nginx.org/en/docs/
    Process: 13951 ExecStop=/bin/sh -c /bin/kill -s TERM $(/bin/cat /var/run/nginx.pid) (code=exited, status=1/FAILURE)
    Process: 14184 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS)
   Main PID: 14185 (nginx)
     CGroup: /system.slice/nginx.service
             ├─14185 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
             └─14186 nginx: worker process
  
  Oct 07 07:34:00 centos7 systemd[1]: Starting nginx - high performance web server...
  Oct 07 07:34:00 centos7 systemd[1]: Started nginx - high performance web server.
  
  </code></pre>
  <p>here is my nginx.service configuration</p>
  <pre class="lang-sh prettyprint-override"><code>cat /usr/lib/systemd/system/nginx.service
  [Unit]
  Description=nginx - high performance web server
  Documentation=http://nginx.org/en/docs/
  After=network-online.target remote-fs.target nss-lookup.target
  Wants=network-online.target
  
  [Service]
  Type=forking
  PIDFile=/var/run/nginx.pid
  ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf
  ExecReload=/bin/sh -c &quot;/bin/kill -s HUP $(/bin/cat /var/run/nginx.pid)&quot;
  ExecStop=/bin/sh -c &quot;/bin/kill -s TERM $(/bin/cat /var/run/nginx.pid)&quot;
  
  [Install]
  WantedBy=multi-user.target
  
  </code></pre>