nginx 단순 사이트 배치(centos 7)
1889 단어 project
[root@client1 ~]# cd /etc/yum.repos.d/
[root@client1 yum.repos.d]# vim nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1
[root@client1 yum.repos.d]# yum -y install nginx
[root@client1 yum.repos.d]# cd /etc/nginx/conf.d/
[root@client1 conf.d]# vim a.org.conf
server {
server_name www.a.org a.org;
error_log /usr/local/nginx/logs/a.org/error.org error;
access_log /usr/local/nginx/logs/a.org/access.log main;
location / {
root /a.org;
index index.html;
}
}
[root@client1 ~]# mkdir -p /usr/local/nginx/logs/a.org
[root@client1 ~]# mkdir -p /a.org
[root@client1 ~]# echo welcome to nginx > /a.org/index.html
[root@client1 ~]# cd /etc/nginx/conf.d/
[root@client1 conf.d]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@client1 conf.d]# systemctl start nginx
[root@client1 ~]# ss -antp |grep 80
LISTEN 0 128 *:80 *:* users:(("nginx",pid=1244,fd=8),("nginx",pid=1243,fd=8))
[root@client1 conf.d]# curl 192.168.122.137
welcome to nginx
[root@client1 conf.d]# curl www.a.org
301 Moved Permanently
301 Moved Permanently
nginx
[root@client1 conf.d]# cp a.org.conf b.org.conf
[root@client1 conf.d]# vim b.org.conf
server {
server_name www.b.org b.org;
error_log /usr/local/nginx/logs/b.org/error.org error;
access_log /usr/local/nginx/logs/b.org/access.log main;
location / {
root /b.org;
index index.html;
}
}
[root@client1 conf.d]# mkdir /b.org
[root@client1 conf.d]# mkdir /usr/local/nginx/logs/b.org
[root@client1 conf.d]# vim /b.org/index.html
[root@client1 conf.d]# systemctl stop nginx
[root@client1 conf.d]# systemctl start nginx
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Personal analysis of the Daily project on GitHubAnalysis of other people's projects on github. Learn from him well. https://github.com/spring2613/Daily The project has ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.