**prefix는 경로는 다음과 같다.**
- /usr/local/nginx/conf
- /etc/nginx
- /usr/local/etc/nginx
**여기서 나의 경우에는 /etc/nginx다**
Starting, Stopping, and Reloading Configuration
- **To start nginx, run the executable file. Once nginx is started, it can be controlled by invoking the executable with the -s parameter. Use the following syntax:**
```shell
nginx -s signal
```
- **To stop nginx processes with waiting for the worker processes to finish serving current requests, the following command can be executed:**
```shell
nginx -s quit
```
- **To reload configuration, execute**
```shell
nginx -s reload
```
Serving Static Content
- **File Directory**
```text
directory
/data/www > which my contain HTML files
index.html이 보통 들어감.
/data/images > containing images
```
초기 Setting 방법
- **nginx 초기 setting 방법**
- prefix 경로를 찾는다. 여기서 나의 경우는 /etc/nginx/인데
- 이 밑에 nginx.conf 파일을 찾아서 해결한다.
- 이를 sudo nano로 열어서 편집을 한다.
```shell
http {
server {
listen 8080;
location / {
root /home/nginxServer/test1/data/www;
}
location ~ \.(gif|jpg|png)$ {
root /home/nginxServer/test1/data/images;
}
}
}
```
- http 괄호 안에 다음과 같은 형식으로 넣는다.
- 이후에, systemctl 명령어를 써서 프로세스를 진행한다.
```shell
sudo systemctl start nginx
```
- 파일 변경 후, reload 할 경우 다음 두가지 방식으로 갱신이 가능하다
```shell
sudo nginx -s reload
sudo systemctl reload nginx
```
'코딩 > cpp' 카테고리의 다른 글
| [백준] 18111번 (0) | 2025.10.01 |
|---|---|
| [nginx] 설치 법 및 설정 법 (0) | 2025.09.30 |
| [nginx/포트폴리오 프로젝트] proxy_pass란 무엇인가 (0) | 2025.09.30 |
| [백준]11724번 (0) | 2025.09.29 |
| [백준] 11279번 (0) | 2025.09.29 |