php - Can't get correct page by using "service nginx start " but ok by using "nginx"
Get the solution ↓↓↓Os: CentOS-7-x86_64-Minimal-1611
nginx: 1.2.1 (installed by yum)
php: php7.0.1
I useservice nginx start
to start nginx, I got 403 forbidden
But when I usenginx
, I get the correct page.
I've tried to change "nginx.conf",user nginx
touser root
, then I can't useservice nginx start
anymore (the same as service nginx restart/stop)
I have tried to change dir's group and user but failed.
Answer
Solution:
Rollback your changes in nginx.conf and then check SELinux status bysestatus
orgetenforce
command. If it returns enforcing set SELinux to permissive mode bysetenforce 0
command and check nginx.
If it not works set your nginx root directory permission as follow :
chown nginx:nginx /path/to/nginx/root/directory chmod 755 /path/to/nginx/root/directory
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: fastcgi sent in stderr: "primary script unknown" while reading response header from upstream
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.