본문 바로가기

리눅스 헛다리/Rocky9.5

Rocky nginx 설치

728x90

Rocky nginx 설치

 

Nginx를 설치

sudo dnf install -y nginx

시스템 부팅 시 자동으로 시작

sudo systemctl start nginx

sudo systemctl enable nginx



ci4 프로젝트

vi /etc/nginx/conf.d/vhost_프로젝트.conf

 

server {
    listen 80;
    server_name 프로젝트.test.com;

    root /home/프로젝트/public;
    index index.html index.htm index.php;

    # HTTP 요청을 HTTPS로 리다이렉트 (필요시 활성화)
    #if ($http_x_forwarded_proto != "https") {
    #     return 301 https://$host$request_uri;
    #}

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass unix:/run/php-fpm/www.sock;
    }

    location ~ /\.ht {
        deny all;
    }
}

 

 

필요시

sudo chown nginx:nginx /run/php-fpm/www.sock

sudo chmod 660 /run/php-fpm/www.sock

728x90

'리눅스 헛다리 > Rocky9.5' 카테고리의 다른 글

Rocky 로드밸런서 haproxy  (0) 2025.03.27
Rocky ftp 설치  (0) 2025.02.28
Rocky php8.3설치  (0) 2025.02.28
Rocky mariadb 설치  (0) 2025.02.28
Rocky dnf 업데이트  (0) 2025.02.28