我正在尝试使用debian风格的目录结构从我的共享主机的用户文件夹中的源代码运行Nginx.我尝试启动服务器时遇到错误:
[emerg] invalid number of arguments in "try_files" directive in /home/.../nginx/conf/sites-enabled/default:11
Run Code Online (Sandbox Code Playgroud)
引用的行是来自Nginx陷阱页面的PHP执行保护.这是我的配置文件:
nginx.conf:
worker_processes 1;
events {
worker_connections 1024;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
client_max_body_size 5m;
include /home/hittingsmoke/nginx/conf/mime.types;
default_type application/octet-stream;
gzip on;
gzip_disable \"msie6\";
include /home/hittingsmoke/nginx/conf/sites-enabled/*;
}
Run Code Online (Sandbox Code Playgroud)
...和sites-available/default:
server {
listen 12513;
root /home/hittingsmoke/nginx/html/;
index index.php index.html index.htm;
server_name _;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/home/hittingsmoke/php-5.3/var/run/php5-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
}
# redirect server …Run Code Online (Sandbox Code Playgroud) 我将尽可能地在这里绝对冗长,因为我遇到了一些没有最终淘汰的解决方案.请记住,我不知道Javascript.我知道基本的HTML和CSS.我没有任何实际的编程背景,但我正在尝试通过研究这样的基本任务来逐步学习.请跟我说说我是个白痴.我在研究这个具体问题的过程中学到了这篇文章.我正在将此用户手写为个人项目,并与一些朋友分享.
我正在尝试为Chrome/Greasemonkey编写用户脚本(Chrome是我的目标浏览器),它将点击Battlefield 3服务器浏览器上的" 刷新"按钮.对于那些不知道的人,"战地3"使用一个与VOIP浏览器插件配对的网站,并通过服务器浏览器实际启动游戏.它的大部分似乎是在表格中排列的相当直接的HTML.
我们的想法是,当查看已满服务器的主页面时,脚本将每隔三秒左右单击" 刷新"按钮,直到该页面报告服务器上的开放点,然后停止刷新循环并单击"加入服务器"按钮.我已经运行了脚本运行的部分,轮询服务器当前和最大的玩家然后将它们分配给他们自己的变量.
此时我正试图在控制台中点击一下工作,这样我就可以在脚本中使用它并且运气不好.
这是我试图从Chrome开发工具中点击的按钮的div:
<div class="serverguide-header-refresh-button alternate show">
<div type="reset" class="common-button-medium-grey">
<p style="position: relative;">
<a href="/bf3/servers/show/c7088bdc-2806-4758-bf93-2106792b34d8/">Refresh </a>
</p>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
(该链接不是静态的.它是指向特定服务器页面的链接)
要实际找到我正在使用的按钮getElementsByClassName.它没有唯一的ID,但该类对于此特定页面上的元素是唯一的,因此getElementsByClassName("serverguide-header-refresh-button")[0]每次都会拉出适当的div.它正在让脚本对按钮执行任何实际操作,这就是问题所在.
document.getElementsByClassName("serverguide-header-refresh-button")[0].click();
Run Code Online (Sandbox Code Playgroud)
我现在意识到这不起作用,因为它不是传统的提交按钮.我不明白标准的具体细节,但我得知它不支持该.click()方法.
function addJQuery(callback) {
var script = document.createElement("script");
script.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js");
script.addEventListener('load', function() {
var script = document.createElement("script");
script.textContent = "(" + callback.toString() + ")();";
document.body.appendChild(script);
}, false);
document.body.appendChild(script);
}
// the guts of this userscript
function main() {
unsafeWindow.jQuery('.serverguide-header-refresh-button')[0].click();
} …Run Code Online (Sandbox Code Playgroud) javascript automation greasemonkey javascript-events userscripts