Extra Form
PHP PHP 7.4
CMS Rhymix 2.x

 

nginx 서버를 재시작 하려고 하니 아래 같은 메세지가 나옵니다.

Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

 

 

"journalctl -xe" 로 실행해 보니 아래와 같이 나오는데 괜찮은걸까요?

 

-- Unit nginx.service has begun starting up.
May 11 09:37:18 velomano-i nginx[19954]: nginx: [emerg] "try_files" directive is not allowed here in /etc/nginx/snippets
May 11 09:37:18 velomano-i nginx[19954]: nginx: configuration file /etc/nginx/nginx.conf test failed
May 11 09:37:18 velomano-i sudo[19947]: pam_unix(sudo:session): session closed for user root
May 11 09:37:18 velomano-i systemd[1]: nginx.service: Control process exited, code=exited status=1
May 11 09:37:18 velomano-i systemd[1]: nginx.service: Failed with result 'exit-code'.
May 11 09:37:18 velomano-i systemd[1]: Failed to start A high performance web server and a reverse proxy server.
-- Subject: Unit nginx.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support

 

 

 

추가로 현재 설정파일 상태입니다.

 

# Default HTTPS server configuration
server {
    listen 443 ssl http2 default_server;
    listen [::]:443 ssl http2 default_server;
    server_name feedzone.club;
 
    ssl_certificate /etc/letsencrypt/live/feedzone.club/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/feedzone.club/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/feedzone.club/fullchain.pem;
    include /etc/nginx/snippets/ssl.conf;
 
    root /var/www/html;
    index index.php index.html index.htm index.nginx-debian.html;
    client_max_body_size 20m;   # 업로드 허용 용량 (라이믹스는 분할 업로드를 지원하므로 약 10MB만 넘으면 사실상 무한대가 됩니다.)
    
    include snippets/rhymix.conf;   # 라이믹스 rewrite 규칙 인클루드

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.4-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
       fastcgi_read_timeout 300;
    }
    
 
 
    location ~ /\.ht {
        deny all;
   }
}
 
# HTTPS www. server configuration
server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name www.feedzone.club;
 
    ssl_certificate /etc/letsencrypt/live/feedzone.club/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/feedzone.club/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/feedzone.club/fullchain.pem;
    include /etc/nginx/snippets/ssl.conf;
 
    location / {
        return 301 https://feedzone.club$request_uri;
    }
}
 
 
# Default server configuration
server {
    listen 80;
    listen [::]:80 default_server;
    server_name feedzone.club;
 
    include /etc/nginx/snippets/letsencrypt.conf;
 
    return 301 https://feedzone.club$request_uri;

}
 
# HTTP - CNAME Connect www.feedzone.club to feedzone.club
server {
    listen 80;
    listen [::]:80;
    server_name www.feedzone.club;
 
    include /etc/nginx/snippets/letsencrypt.conf;
 
    return 301 https://feedzone.club$request_uri;
}

 include snippets/fastcgi-php.conf;
         fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
         include fastcgi_params;

-- 
-- Unit nginx.service has failed.
-- 
-- The result is RESULT.

 

 

이왕 서버파일까지 올린김에 메인도메인 하위 도메인을 연결하는중인데 https나  ssl이 문제가 되는 것 같은데

저는 이미 메인 도메인에서 설정해줘서 하위 도메인은 따로 서버 값에 안써도 될것 같아서 생략 했는데

하위 도메인도 메인도메인처럼 따로 ssl 인증을 받아서 서버파일에 기록해줘야 할까요?

보고 따라하는 사이트가 이 내용이 없어서인지 도메인 연결이 참 어렵네요.

 

  • profile
    nginx 서버재시작 명령어 때문인지 갑자기 사이트 연결이 또 안되네요.
  • profile
    nginx 서버에 문제가 생긴 것 같습니다. 미디어위키쪽 서버 conf 파일 일부를 지우고 클라우드서버 재부팅 했는데 아직 사이트 접속은 안되네요.

    nginx: [emerg] "try_files" directive is not allowed here in /etc/nginx/snippets/fastcgi-php.conf:5
    nginx: configuration file /etc/nginx/nginx.conf test failed
    ubuntu@velomano-i:/$ sudo service nginx restart
    Job for nginx.service failed because the control process exited with error code.
    See "systemctl status nginx.service" and "journalctl -xe" for details.
    ubuntu@velomano-i:/$ service nginx restart
    ==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
    Authentication is required to restart 'nginx.service'.
    Authenticating as: Ubuntu (ubuntu)
    Password:
    polkit-agent-helper-1: pam_authenticate failed: Authentication failure
    ==== AUTHENTICATION FAILED ===
    Failed to restart nginx.service: Access denied
    See system logs and 'systemctl status nginx.service' for details.
    ubuntu@velomano-i:/$ Connection to feedzone.club closed by remote host.
    Connection to feedzone.club closed.
    velomanos-MacBook-Pro:/ velomano$
  • ?
    /etc/nginx/snippets/fastcgi-php.conf 파일에 try_files 위치가 올바르지 않답니다!
  • ? profile
    nginx: [emerg] "try_files" directive is not allowed here in /etc/nginx/snippets/fastcgi-php.conf:5
    nginx: configuration file /etc/nginx/nginx.conf test failed

    이렇게 뜨네요. 위에 알려 주신 해당 파일 열어서 어딜 수정해야할까요?
    아무래도 라이믹스와 미디어위키 서버 설정 파일이 충돌해서 생긴 문제 같아서 미디어위키쪽 서버 파일 내용 대부분 삭제했는데 아직 해결이 안되네요.
  • profile
    [해결] 서버 설정파일 하단에 뜬금 없이
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;

    요 내용이 들어가 있어서 오류가 났던것 같습니다. 미디어위키 서버 파일 설정하면서 실수가 있었던것 같네요.
    덕분에 또 사이트가 한시간 반 가까이 접속이 안되었습니다. ㅜ ㅜ. 이래저래 실수가 많네요.
  • profile
    다음부터는 restart 대신 reload를 활용해 보세요. reload시 설정파일에 오류가 있다면 기존 설정파일로 계속 동작하므로 서버가 마비될 위험성이 없습니다.
  • profile profile
    감사 합니다. reload로 안되는걸 무리하게 진행하다가 문제를 만들었네요. 하위도메인 설정이 ssl인증 때문에 쉽지 않아서 일단 보류해야 할것 같습니다.