2016-09-22 103 views
0

我很多google搜索,但沒有找到一個解決方案,我試圖啓動nginx的基本配置之後,我收到以下錯誤:nginx的權限被拒絕時嘗試啓動

Set 21 23:57:53 vps.medjy.ml nginx[21444]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok 
Set 21 23:57:53 vps.medjy.ml nginx[21444]: nginx: [emerg] open() "/srv/www/medjey/logs/access.log" failed (13: Permission denied) 
Set 21 23:57:53 vps.medjy.ml nginx[21444]: nginx: configuration file /etc/nginx/nginx.conf test failed 
Set 21 23:57:53 vps.medjy.ml systemd[1]: nginx.service: control process exited, code=exited status=1 
Set 21 23:57:53 vps.medjy.ml systemd[1]: Failed to start nginx - high performance web server. 

虛擬主機的文件在/ etc/nginx的/網站可用/ medjey相同下面這樣:

server { 
    listen 80 default; 
    server_name medjey; 
    access_log /srv/www/medjey/logs/access.log; 
    error_log /srv/www/medjey/logs/error.log; 
    root /srv/www/medjey/public_html; 
    location ~* \.php$ { 
    fastcgi_index index.php; 
    fastcgi_pass 127.0.0.1:9000; 
    include   fastcgi_params; 
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
    fastcgi_param SCRIPT_NAME  $fastcgi_script_name; 
    } 

和/etc/nginx/nginx.conf是相同的:

user nginx; 
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] "$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; 
## Load virtual host conf files. ## 
    include /etc/nginx/sites-enabled/*; 
    include /etc/nginx/conf.d/*.conf; 
} 

我已經改變了所有的權限和所有者,但它仍然沒有提供服務。

CentOS的7

回答

0

解決,只是需要改變的/ etc/SYSCONFIG/SELinux的到SELINUX=permissive並調整了IP服務器名稱變更虛擬主機。

+0

對不起,這是什麼新的服務器名稱?我在FreeBSD上遇到同樣的問題。 –

0

使用sestatuss檢查防火牆是否打開。

我也面臨同樣的問題。 只要禁用Selinux

相關問題