默认根目录是default
在default下新建的test.html,可以正常访问
将根目录改为html2
上传静态资源到html2后,并reload,访问还是default下的index.html
登陆购买课程后可参与讨论,去登陆吧
同学你好,1、建议同学重新打开配置文件,查看是否有将修改的内容保存。如果没有报错,则建议同学重新进行修改,然后进行保存重新测试试一下。
2、也有可能是缓存的问题,建议同学清除浏览器缓存并重启服务器(Mac电脑)试一下。
3、如果还存在问题,建议同学尝试文件拷贝到html目录下尝试一下。
祝学习愉快!
老师,我这是在阿里云服务器中运行的nginx,访问IP显示这个页面是正常的吗?
同学你好,显示这个页面是错误,根据同学反馈的ip老师这边是可以正确访问的。如下所示:同学访问错误可能是浏览器的问题,建议同学换一个浏览器试一下。
现在访问IP正常显示welcome页面了
但是访问之前写的test.html,显示404,这是什么原因呢?
test.html在/data/wwwroot/default目录下
配置文件:
user www www; worker_processes auto; error_log /data/wwwlogs/error_nginx.log crit; pid /var/run/nginx.pid; worker_rlimit_nofile 51200; events { use epoll; worker_connections 51200; multi_accept on; } http { include mime.types; default_type application/octet-stream; server_names_hash_bucket_size 128; client_header_buffer_size 32k; large_client_header_buffers 4 32k; client_max_body_size 1024m; client_body_buffer_size 10m; sendfile on; tcp_nopush on; keepalive_timeout 120; server_tokens off; tcp_nodelay on; fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; fastcgi_buffer_size 64k; fastcgi_buffers 4 64k; fastcgi_busy_buffers_size 128k; fastcgi_temp_file_write_size 128k; fastcgi_intercept_errors on; #Gzip Compression gzip on; gzip_buffers 16 8k; gzip_comp_level 6; gzip_http_version 1.1; gzip_min_length 256; gzip_proxied any; gzip_vary on; gzip_types text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml text/javascript application/javascript application/x-javascript text/x-json application/json application/x-web-app-manifest+json text/css text/plain text/x-component font/opentype application/x-font-ttf application/vnd.ms-fontobject image/x-icon; gzip_disable "MSIE [1-6]\.(?!.*SV1)"; ##Brotli Compression #brotli on; #brotli_comp_level 6; #brotli_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript image/svg+xml; ##If you have a lot of static files to serve through Nginx then caching of the files' metadata (not the actual files' contents) can save some latency. #open_file_cache max=1000 inactive=20s; #open_file_cache_valid 30s; #open_file_cache_min_uses 2; #open_file_cache_errors on; log_format json escape=json '{"@timestamp":"$time_iso8601",' '"server_addr":"$server_addr",' '"remote_addr":"$remote_addr",' '"scheme":"$scheme",' '"request_method":"$request_method",' '"request_uri": "$request_uri",' '"request_length": "$request_length",' '"uri": "$uri", ' '"request_time":$request_time,' '"body_bytes_sent":$body_bytes_sent,' '"bytes_sent":$bytes_sent,' '"status":"$status",' '"upstream_time":"$upstream_response_time",' '"upstream_host":"$upstream_addr",' '"upstream_status":"$upstream_status",' '"host":"$host",' '"http_referer":"$http_referer",' '"http_user_agent":"$http_user_agent"' '}'; ######################## default ############################ server { listen 80; server_name _; access_log /data/wwwlogs/access_nginx.log combined; root /data/wwwroot/default; index index.html index.htm index.jsp; #error_page 404 /404.html; #error_page 502 /502.html; location /nginx_status { stub_status on; access_log off; allow 127.0.0.1; deny all; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { expires 30d; access_log off; } location ~ .*\.(js|css)?$ { expires 7d; access_log off; } location ~ { proxy_pass http://127.0.0.1:8080; include proxy.conf; } location ~ ^/(\.user.ini|\.ht|\.git|\.svn|\.project|LICENSE|README.md) { deny all; } location /.well-known { allow all; } } ########################## vhost ############################# include vhost/*.conf;
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
登录后可查看更多问答,登录/注册
综合就业常年第一,编程排行常年霸榜,北上广深月薪过万! 不需要基础,无需脱产即可学习,只要你有梦想,想高薪! 全新升级:技术栈升级(包含VUE3.0,ES6,Git)+项目升级(前后端联调与功能升级)
79 1
56 1
9 1
14 1
56 9
在线咨询
领取优惠
免费试听
领取大纲
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星