向小伙伴们求助:
Nginx好像是不生效,昨天折腾到三点多,还是没弄好。
前后端应用,我先指望前端生效。
域名为 fccareer.top,在cloudflare管理,配置了DNS解析:
应用使用pm2启动,可以通过IP+端口号正常调用。
如下:
FIFA Career Dashboard
FIFA Career Dashboard Backend
Nginx 配置却死活不行,怎么访问都是返回默认的页面 Test Page for the Nginx HTTP Server on Oracle Linux (app.fccareer.top)
这是我的Nginx配置:
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'
'Server: $host';
access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
# 前端应用
server {
listen 443 ssl; # managed by Certbot
server_name app.fccareer.top;
location / {
proxy_pass http://localhost:3001; # 前端应用的端口
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
ssl_certificate /etc/letsencrypt/live/fccareer.top/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/fccareer.top/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
}
请问这是为何,以上地址均可访问。向L佬们求助,感激~