nginx 2 급 도 메 인 이름 설정 (다단 계 도 메 인 이름)
원인
앞서 v2 에서 독 계탕 을 보고 좋아 했 습 니 다. 제 블 로그 에 도 배치 할 생각 을 했 습 니 다. 도 메 인 이름 은 2 급 도 메 인 이름 Dujitang. fly will. cn 을 사 용 했 습 니 다. 제 서버 가 Nginx 이기 때문에 2 급 도 메 인 이름 을 설정 하 는 글 이 있 습 니 다.
프로 세 스
먼저 구 글 을 살 펴 보고 얻 은 결과.
단일 파일 설정
# , nginx,
#user nginx;
# , cup
worker_processes 1;
# , notice info ,
#error_log;
#nginx ID ,
#pid logs/nginx.pid;
#
events {
#epoll IO(I/O Multiplexing)
# ! linux2.6 , nginx
#use epoll
# ( 、 , )
worker_connections 1024;
}
#http ,
http {
server {
# , 80 , 【 】
listen 80;
# Ip ( )
# ! localhost !
server_name localhost;
# , 【 】 , index.php
location / {
# root
root /home/web/wechat;
# 【inde.php】 , ! ! !
index index.html index.htm index.php;
}
# , nginx .php , php-fpm
location ~ \.php$ {
# root
root /home/web/wechat;
# ,
fastcgi_pass 127.0.0.1:9000;
# index.php
fastcgi_index index.php;
# !
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# ! nginx, php
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
#ok! perfect, server , ?
# ! ,
# ? , ,
server{
# , ! !
server_name http:#www.jiandanmeng.cn/; #
}
}
여 기 는 단일 파일 로 설정 되 어 있 습 니 다. 분명 합 니 다. 우아 하지 않 습 니 다.
다 중 파일 설정
다 중 파일 설정 을 사용 합 니 다. 설정 파일 을 먼저 보 겠 습 니 다.
cd /etc/nginx
vim nginx.conf
http
구조 에서 include /etc/nginx/conf.d/*.conf;
이 폴 더 아래 .conf
파일 로 끝 나 는 모든 파일 을 도 입 했 습 니 다.http {
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
그래서 당신 이 해 야 할 일 은 이 디 렉 터 리 에 새로운 2 급 도 메 인 이름 의 설정 파일 을 만 드 는 것 입 니 다.
server {
listen 80; #
server_name dujitang.flywill.cn; #
root /var/www/html/dujitang/; # ,
index index.php index.html index.htm; #
# rewrite ^(.*)$ https://$host$1 permanent; # http https
location / {
root /var/www/html/dujitang/;
index index.html index.htm index.php;
}
# ,
error_page 404 /404.html;
location /404.html {
root /usr/local/nginx/html/;
}
error_page 500 502 503 504 /50x.html;
location =/50x.html {
root /usr/local/nginx/html/;
}
}
그리고 nginx 를 다시 시작 하면 됩 니 다.
systemctl restart nginx.service
구 덩이 를 밟다
새 프로필 은
server
급 만 있 으 면 됩 니 다. 다른 예 를 들 어 http
, event
메 인 프로필 에 쓰 면 됩 니 다.구체 적 으로 는 여 기 를 클릭 하여 볼 수 있다.
전재 에 오신 것 을 환영 합 니 다. 전재 출처 를 밝 혀 주세요!독립 도 메 인 네 임 블 로그: fly will. cn 은 대중 마이크로 신호 에 관심 을 가 지 는 것 을 환영 합 니 다: 자바 타 운 V 는 자신의 학습 & 학습 자 료 를 공유 하고 생활 하고 교류 하고 자 하 는 친구 도 마이크로 신호 주입 군: EscUpDn
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.