求助 nginx 相关问题! v2er 救救孩子吧!呜呜呜!

2023-09-08 16:31:32 +08:00
 chenli100681
叠个甲先:本人非计算机相关专业大学生,根据 R 神 xtls 教程一步步建梯子。重点来了:我是傻逼!我是傻逼!我是傻逼!高贵的 v2er 们帮帮我这个唐氏吧!

现在到了做伪装网站一步。我先概述一下我的材料准备情况。

有一个().me 的域名,在 cloudflare 已经添加了一条指向我 vps 的 A 记录解析,ssl 安全选的是 full(strict)模式

vps 甚至防火墙都关了,端口放行应该没啥问题。

vps 已经安装 nginx ,vps 非 root 登录,用的是用户名()登录,在/home/()/www/webpage 里面搞了个简单的 index.html,去/etc/nginx/nginx.conf 里面设置的路径也绝对是对的

但是!

访问域名只显示那个经典的 welcome to nginx ,而不是我 index.html 里面内容,我怀疑因为这一步出错,导致我后面一步申请 ssl 证书也失败了(我猜是 CA 无法判断我掌控该域名?)

真给我愁死了,呜呜呜,打个胶先

![第一次发帖加图片]( https://imgur.com/a/FMJnadK)

![我测,imgur 好像可以几张图片一个链接]( https://imgur.com/a/FMJnadK)
2859 次点击
所在节点    程序员
55 条回复
OceanBreeze
2023-09-08 16:42:51 +08:00
`nginx -s reload` 了么
yzding
2023-09-08 16:43:57 +08:00
证书申请打开 --debug 看看,是不是 Nginx 占用了端口没启动 acme 验证成功
clickhouse
2023-09-08 16:46:44 +08:00
1. 修改完 nginx 配置之后有做 reload 吗?
2. 是采用访问域名内特定文件的方式验证域名所有权申请 SSL 证书的吗?正常使用验证 DNS TXT 解析的方式是比较多的,建议 OP 详细说一下是什么途径什么方式申请的证书。
defunct9
2023-09-08 16:46:54 +08:00
开 ssh ,让我上去看看
Asakijz
2023-09-08 16:52:19 +08:00
开 ssh ,让他上去看看 @defunct9
chenli100681
2023-09-08 16:54:40 +08:00
@OceanBreeze #1 sudo systemctl reload 我都敲烂了,呜呜呜
chenli100681
2023-09-08 16:54:58 +08:00
@defunct9 #4 逆天
chenli100681
2023-09-08 16:56:29 +08:00
@clickhouse #3 reload 过了,然后第二点我先去谷歌一下你说的啥意思(我比较菜)但我用的命令是这个 acme.sh --issue --server letsencrypt --test -d 二级域名.你的域名.com -w /home/vpsadmin/www/webpage --keylength ec-256
感谢大佬!
chenli100681
2023-09-08 16:56:48 +08:00
@yzding #2 okok ,我去看看去,首先感谢大佬!
chenli100681
2023-09-08 16:58:23 +08:00
@Asakijz #5 我读书少,怎么感觉不太对劲
mabeple
2023-09-08 16:58:49 +08:00
sadfQED2
2023-09-08 17:00:35 +08:00
nginx 配置内容贴上来,我目测你都没把 web 页面路径指向你写的那个 html
chenli100681
2023-09-08 17:06:32 +08:00
@sadfQED2 #12 我想回复您图片,但 v2 说我是太新的用户不让发。麻烦您看一下我帖子最后一行里面最后一张图片?nginx.conf 里面我路径写了/home/()/web/webpage 了,应该不会错,查了好久,呜呜,感谢!
NessajCN
2023-09-08 17:08:41 +08:00
依次打以下几个命令,把结果贴上来
ls -alF /etc/nginx/sites-enabled
cat /etc/nginx/sites-available/default
cat /etc/nginx/nginx.conf

贴全
sadfQED2
2023-09-08 17:13:01 +08:00
你这个配置文件不对吧,我感觉你 nginx 加载的不是这个文件,cf 通过 https 请求你服务器的,但是你这个配置文件是 80 端口的
chenli100681
2023-09-08 17:13:59 +08:00
@NessajCN #14 不管怎样,先给您磕一个!
total 8
drwxr-xr-x 2 root root 4096 Sep 2 07:32 ./
drwxr-xr-x 8 root root 4096 Sep 8 07:37 ../
lrwxrwxrwx 1 root root 34 Sep 2 07:32 default -> /etc/nginx/sites-available/default

##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications, such as Drupal or Wordpress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Default server configuration
#
server {
listen 80 default_server;
listen [::]:80 default_server;

# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;

root /var/www/html;

# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;

server_name _;

location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}

# pass PHP scripts to FastCGI server
#
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
# fastcgi_pass unix:/run/php/php7.4-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}


# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
# listen 80;
# listen [::]:80;
#
# server_name example.com;
#
# root /var/www/example.com;
# index index.html;
#
# location / {
# try_files $uri $uri/ =404;
# }
#}

user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
worker_connections 768;
# multi_accept on;
}

http {

##
# Basic Settings
##

sendfile on;
tcp_nopush on;
types_hash_max_size 2048;
# server_tokens off;

# server_names_hash_bucket_size 64;
# server_name_in_redirect off;

include /etc/nginx/mime.types;
default_type application/octet-stream;

##
# SSL Settings
##

ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;

##
# Logging Settings
##

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

##
# Gzip Settings
##

gzip on;

# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

##
# Virtual Host Configs
##

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;

server {
listen 80;
server_name shayu100861.me;
root /home/vpssf/www/webpage;
index index.html;
}

}


#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}
sadfQED2
2023-09-08 17:14:20 +08:00
你配置文件里面是不是还有一个监听 443 端口的 server 配置?你要改那个才行
NessajCN
2023-09-08 17:19:10 +08:00
@chenli100681
这样就清楚了
首先你在/etc/nginx/nginx.conf 里 include /etc/nginx/sites-enabled/*;
然后你在/etc/nginx/sites-enabled/default 里覆盖了 nginx.conf 里的配置,里面的 root /var/www/html 覆盖了你自己设置的

所以你的处理方法是
要么注释掉 include /etc/nginx/sites-enabled/*; 这一行,
要么把配置写到 /etc/nginx/sites-enabled/default 里
ljh0585
2023-09-08 17:21:47 +08:00
检查下是不是端口被占用了
0m9ionbP8wuvs8S3
2023-09-08 17:24:28 +08:00
建议直接买机场就不用这么麻烦了

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/972086

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX