Nginx 다중 파일 구성 보조 하위 도메인 이름 (권장)
먼저 자체 도메인 이름 콘솔에 분석을 추가합니다. 여기서는 blog 접두사를 예로 들어
wan 을 사용합니다 해결 설정? 중간? 구문 분석
호스트 레코드 추가: 원하는 보조 도메인 이름?
레코드 값: IP 주소
를 저장한 후 하위 도메인 이름을 서버로 확인하는 첫 번째 단계를 완료했습니다.
2 단계: 구성 파일 추가
nginx 입력? /conf? 구성 폴더, 편집? Nginx.conf? 파일
[루트 @ iz2844brz0xz ~] # CD/usr/local/nginx/conf/[루트 @ iz2844brz0x . conf? 파일
[루트 @ iz2844brz0xz conf] # mkdir sites-enabled [루트 @ iz2844brz0xz sites-enabled] # 수신 포트 server _ nameblog. * * *. com; # 도메인 이름 바인딩 root/usr/local/nginx/html/blog/; # 웹 사이트 루트 디렉토리, 절대 경로 indexindex.php index.htmlindex.htm 을 사용하는 것이 좋습니다. # 기본 파일 # PHP 에 대한 구문 분석 위치 추가 ~ \. PHP $ {fastcgi _ pass127.0.0.1: 9000; Fastcgi_indexindex.php;; Fastcgi_param? Script _ filename $ document _ root $ fastcgi _ script _ name; Include/usr/local/nginx/conf/fastcgi _ params; } # 검색 엔진 포함 및 우수한 사용자 경험을 위한 오류 페이지 추가 error _ page404/404.html; 위치/404.html {루트/usr/local/nginx/html/; } error _ page500502503504/50x.html; 위치 =/50x.html {
루트/usr/local/nginx/html/; }}
컨텐츠 자체 추가 가능
Nginx 단일 파일 구성 보조 하위 도메인 이름
? Nginx.conf? 파일? 서버? 모듈에 다음 문
if($host~* (\b (? ! Www \ b) \ w+) \. \ w+\. \ w+) {set $ subdomain/$1; } location/{root html $ subdomain; Indexindex.htmlindex.php index.htmindex; }
해당 폴더로 확인
마지막으로 nginx 를 다시 시작하면
[root @ iz2844brz0xzsites-enabbs