我的 Nginx 设置有三个要求:
其中,我能够实现前两个,但是当我http://localhost/ecwid_fu_scripts/
通过 Web 浏览器访问时,请求被运行在端口 9001 上的 Java 服务器拦截,并且不会路由到index.php
in /home/ankush/ecwid_fu_scripts/
。这是我的 Nginx 配置:
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
location /assets/images/ {
root /home/ankush/fu_main_files/;
autoindex off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 100;
}
location /ecwid_fu_scripts/ {
index index.php;
root /home/ankush/ecwid_fu_scripts/;
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location / {
proxy_pass http://localhost:9001;
}
location ~ …
Run Code Online (Sandbox Code Playgroud) 我现在已经看到了几个这样的例子:Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:3001/assets/css/bootstrap.min.css"
。但是,我无法理解可能是什么原因造成的。
我的简单 PHP 项目中的 CSS 文件没有被提供。状态代码为200
,文件确实加载,并且可以从开发人员控制台查看其内容。我还检查了该/etc/nginx/mime.types
文件,它有一个text/css
. 最后,这是我的网站配置:
server {
listen 3001 default_server;
listen [::]:3001 default_server;
server_name _;
location / {
root /media/common/code/projects/newdf;
try_files $uri $uri/ =404;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
}
}
Run Code Online (Sandbox Code Playgroud)
即使在代码中,HTML 标记也将类型指定为text/css
:
<link rel="stylesheet" type="text/css" href="<?php echo $server_url; ?>/assets/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="<?php echo $server_url; ?>/assets/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="<?php echo …
Run Code Online (Sandbox Code Playgroud) 我对服务器一无所知,而且必须设置后缀给我带来了困难。我知道这个错误很常见,但即使花了半天时间并尝试了各种解决方案,也没有任何效果。有人可以好心地扶我一下吗?
我从 digitalocean (128.199.248.101) 购买了一个域名 (plainsight.in) 和一台服务器,并尝试将它们设置为发送电子邮件。最终目标是设置 TLS 和整个 shebang 并将电子邮件发送到 gmail.com,但目前甚至本地主机到本地主机的邮件都无法正常工作:
telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 dev.plainsight.in ESMTP Postfix (Ubuntu)
helo localhost
250 dev.plainsight.in
mail from: root@localhost
250 2.1.0 Ok
rcpt to: root@localhost
451 4.3.0 <root@localhost>: Temporary lookup failure
Run Code Online (Sandbox Code Playgroud)
这让我很困惑。为什么 localhost 到 localhost 会导致查找失败?
至少所有邮件设置都是正确的,如 mxtoolbox页面所示。此外,我的 main.cf 文件如下所示:
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line …
Run Code Online (Sandbox Code Playgroud)