방금 내 서버 (Ubuntu 11.04)에서 nginx 1.0.6을 완전히 제거했습니다.
apt-get remove nginx
rm -rf /etc/nginx/
rm -rf /usr/sbin/nginx
rm /usr/share/man/man1/nginx.1.gz
apt-get remove nginx*
이제 다시 설치하고 싶지만 nginx를 시작할 때 다음과 같은 오류가 발생합니다.
nginx 재시작 : nginx : [emerg] open () “/etc/nginx/nginx.conf”실패 (2 : 해당 파일 또는 디렉토리가 없음)
그런 다음 내 자신의 conf 파일을 배치하면 새로운 오류가 발생합니다.
nginx 재시작 : nginx : [emerg] open () “/etc/nginx/mime.types”가 실패했습니다 (2 : 해당 파일 또는 디렉토리가 없음) /etc/nginx/nginx.conf:12
이제 apt-get install nginx
완전히 설치되지 않은 것 같습니다. apt-get 캐시를 지우고 도움이되지 않는 것 같습니다. apt-get을 사용하여 nginx를 전체 설치하려면 어떻게 해야합니까?
답변
apt-get remove --purge nginx nginx-full nginx-common
먼저 실행 한 다음 apt-get install nginx
작동하는지 확인하십시오.
답변
먼저
sudo apt-get -o DPkg::options::=--force-confmiss --reinstall install nginx-common
그런 다음 테스트
sudo nginx -t
답변
sudo apt-get --purge autoremove nginx
성공적으로 제거 할 것인지 묻는 메시지가 표시되지 않으면
which nginx
답변
같은 문제가 있었고 구성 파일을 다음 /opt/
으로 복사하여 해결했습니다 /etc/
.
cp /opt/nginx/conf/nginx.conf /etc/nginx/
cp /opt/nginx/conf/mime.types /etc/nginx/
답변
우선 이전 nginx를 conf 파일과 함께 완전히 제거해야합니다.
sudo service nginx stop
sudo apt-get --purge autoremove nginx
sudo rm -rf /etc/nginx
sudo rm /usr/sbin/nginx
그런 다음 nginx를 설치하십시오. nginx-extras는 conf 파일에 오류가 있는지 확인할 때 편리합니다.
sudo apt-get install nginx nginx-extras
그런 다음 명령으로 conf 파일이 올바른지 확인하십시오.
sudo nginx -t