我正在尝试设置nginx,因此"static.domain.com"只能提供图像.这就是我想出的,但我知道它可以更有效地完成.如果有人试图访问任何.htm,.php,目录(我还缺少其他任何东西?)文件,我想要服务403.html.当然,除了403.htm和static.htm文件.
我有什么想法可以保证这一点吗?
server {
listen xx.xx.xx.xx:80;
server_name static.domain.com;
root /www/domain.com/httpdocs;
index static.htm;
access_log off;
error_log /dev/null crit;
error_page 403 /403.html;
# Disable access to .htaccess or any other hidden file
location ~ /\.ht {
deny all;
}
location ~* \.php {
deny all;
}
# Serve static files directly from nginx
location ~* \.(jpg|jpeg|gif|png|bmp|ico|pdf|flv|swf|exe|html|htm|txt|css|js) {
add_header Cache-Control public;
add_header Cache-Control must-revalidate;
expires 7d;
}
}
Run Code Online (Sandbox Code Playgroud) 我刚刚安装了 PHP 7.1,现在看到此错误:
PHP Warning: Cannot assign an empty string to a string offset in /postfixadmin/variables.inc.php on line 31
Run Code Online (Sandbox Code Playgroud)
第 31 行:
$fDomains[0] = "";
Run Code Online (Sandbox Code Playgroud)
PHP 7.1 中现在如何清除 $fDomains[0]?
我正在尝试将( How to create a simple http proxy in node.js? )上接受的答案从http转换为https。
当我尝试从浏览器访问代理时,服务器退出并抛出此错误:
events.js:171
throw TypeError('listener must be a function');
^
TypeError: listener must be a function
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
var https = require('https');
var fs = require('fs');
var ssl = {
ca: fs.readFileSync("cacert.pem"),
key: fs.readFileSync("key.pem"),
cert: fs.readFileSync("cert.pem")
};
https.createServer(ssl, onRequest).listen(3000, '127.0.0.1');
function onRequest(client_req, client_res) {
console.log('serve: ' + client_req.url);
var options = {
hostname: 'www.example.com',
port: 80,
path: client_req.url,
method: 'GET'
};
var ssl = {
ca: fs.readFileSync("cacert.pem"),
key: fs.readFileSync("key.pem"),
cert: fs.readFileSync("cert.pem") …Run Code Online (Sandbox Code Playgroud) 我现在使用的代码只是克隆了“ .comment_post” div,并将表单插入到注释下。
我想做的(如果可能的话)是将“ .comment_post” div“移动”到新位置,而不是克隆它。
关于如何执行此操作的任何建议?
<div class="comment-post">
<form id="addCommentForm" method="post" action="">
<div class="avatar"><img src="http://www.gravatar.com/avatar/ee61e6c16/?s=36&r=g&d=mm" /></div>
<textarea name="txt" id="txt" class="txtcomment"></textarea><button class="btnComment" type="button">Send</button>
</form></div>
<div class="comment">
<span class="avatar"><img src="http://www.gravatar.com/avatar/ee61e6c16/?s=36&r=g&d=mm"></span>
<span class="poster">Jake</a></span><span class="time">5 months ago</span>
<div class="text">just a test comment ...</div>
<div class="reply"><a href="#" onclick="reply(174);">Reply</a></div><div id="new-174"></div>
</div>
<div class="comment">
<span class="avatar"><img src="http://www.gravatar.com/avatar/ee61e6c16/?s=36&r=g&d=mm"></span>
<span class="poster">Jake</a></span><span class="time">5 months ago</span>
<div class="text">another comment ...</div>
<div class="reply"><a href="#" onclick="reply(175);">Reply</a></div><div id="new-175"></div>
</div>
Run Code Online (Sandbox Code Playgroud)
reply = function(id){
if(!$('#new-'+id+' .comment-post').length) {
$('.comment-post:first').clone().attr('id', id).appendTo($('#new-'+id));
$('#new-'+id+' .txtcomment').focus();
$('#new-'+id+' .txtcomment').autosize(); …Run Code Online (Sandbox Code Playgroud)