본문 바로가기
WebServer

Nginx에 php, nodejs 같이 쓰기

by YoYoHa 2021. 5. 17.
728x90
반응형

구성 : nginx php7.2-fpm nodejs

 

vim /etc/nginx/sites-available/default

server {
        listen 80 default_server;
        listen [::]:80 default_server;

        root /var/www/html;

        index index.html index.htm index.nginx-debian.html index.php;

        server_name site;

        location / {
                proxy_pass http://127.0.0.1:8080;
        }

        # pass PHP scripts to FastCGI server
        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        }
}

 

ex) http://도메인/xxxxx.php ( /var/www/html 경로에있는 php파일 실행 )

ex) http://도메인/xxxxx.html ( nodejs 경로의 html 파일 실행 )

728x90
반응형

댓글