방금 새로운 나무 딸기 파이 3을 먹었고 노드가있는 nginx를 설치했습니다. nginx 웹 서버가 실행 중입니다. 그러나 어떻게 든 나는 내 웹 사이트 작업의 javascript를 얻지 못한다. 내 웹 서버의 각 위치에 대해 자바 스크립트를 활성화해야합니까, 아니면 서버의 모든 사이트에서 노드를 작동시키는 방식으로 노드를 설정할 수 있습니까?리눅스 : nginx에 node.js 설정
#########################################
### Directories ###
#########################################
# /www/var/ #
# | - > index.html (the hub/mainpage) #
# | proj1/ #
# | | - > index.html (website 1) #
# | proj2/ #
# | | - > index.html (website 2) #
# | | - > js/somescript.js #
# | proj3/ #
# | | - > index.html (website 3) #
# | | - > js/anotherscript.js #
# | proj4/ #
# | | - > index.html (website 4) #
# | proj5/ #
# | | - > index.html (website 5) #
# | | - > js/morescript.js #
# | ... #
#########################################
당신이 내 웹 사이트 (http://strtpg.xyz)/www가/var에 밖으로 mainpage로 이동/표시에 beeing된다
여기 내 웹 사이트의 디렉토리 계층 구조를 볼 수 있습니다. 이 서버는 서버에서 호스팅되는 다른 모든 사이트에 액세스 할 수있는 허브의 일종입니다. 폴더 이름을 링크에 추가하여 다른 사이트에 액세스 할 수 있습니다 (예 : 'http://strtpg.xyz/proj1'또는 'http://strtpg.xyz/proj5' 사이트 중 일부는 자바 스크립트를 사용하고 일부는 사용하지 않습니다.
그리고이 /etc/nginx/sites-available/
에서 내 설정 파일입니다
# Server configuration
#upstream pnkpnd {
# server localhost:3420;
# keepalive 8;
#}
server {
listen 0.0.0.0:80;
listen [::]:80;
server_name localhost;
index index.html index.htm;
location/{
root /var/www;
try_files $uri $uri/ =404;
# Default root of site won't exist.
#return 410;
}
location /strtpg {
root /var/www;
try_files $uri $uri/ =404;
}
location /dshbrd {
root /var/www;
try_files $uri $uri/ =404;
}
location /pnkpnd {
root /var/www;
try_files $uri $uri/ =404;
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection 'upgrade';
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forward-For $proxy_add_x_Forwarded_for;
# proxy_set_header Host $http_host;
# proxy_set_header X-NginX-Proxy true;
# proxy_pass http://strtpg.xyz/;
# proxy_redirect off;
}
location ~ /\.ht {
deny all;
}
}
내가 주석 내 웹 사이트 작업 노드를 얻기 위해 밖으로 시도, 그래서 적어도 웹 사이트 자체를 볼 수있는 모든 물건.
에서 노드 응용 프로그램 서버에
example.com
에 만들어진 모든 요청? nodeJS에 대한 연결을 찾지 못하는 것 같습니다. 너 나 혼란 스럽다. – Stamos내 서버에서 javascript를 실행하기 위해 node.js가 필요하지 않습니까? – Jub