我最近决定从Apache2切换到Nginx.我在CentOS服务器上安装了Nginx并设置了基本配置.当我尝试在浏览器(FF/Chrome)中加载我的网站时,我注意到没有加载css文件.我检查了错误控制台并看到了这条消息:
Error: The stylesheet http://example.com/style.css was not loaded because its MIME type, "text/html", is not "text/css".
我检查了Nginx配置,一切似乎都很好:
http {
include /etc/nginx/mime.types;
..........
}
Run Code Online (Sandbox Code Playgroud)
css文件的mime类型在/etc/nginx/mime.types中正确设置.
text/css css;
一切似乎配置得很好但我的css文件仍然没有加载.我没有解释.
另一件值得一提的事.最初我使用epel存储库安装了Nginx,我得到了一个旧版本:0.8 ...在我看来,我的问题是该版本中的一个错误所以我卸载了0.8版本,将nginx存储库添加到yum然后安装了最新版本:1.0. 14.我认为新版本将解决我的问题,但不幸的是它没有解决我的想法.
我感谢任何帮助.
配置文件:
/etc/nginx/nginx.conf
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf; …Run Code Online (Sandbox Code Playgroud) 我正在使用mechanize/nokogiri宝石来解析一些随机页面.我遇到301/302重定向问题.以下是代码片段:
agent = Mechanize.new
page = agent.get('http://example.com/page1')
Run Code Online (Sandbox Code Playgroud)
mydomain.com上的测试服务器将使用301/302状态代码将page1重定向到page2,因此我希望有
page.code == "301"
Run Code Online (Sandbox Code Playgroud)
相反,我总是得到page.code == "200".
我的要求是:
我知道我可以看到page1 agent.history,但那不可靠.我也想要重定向状态代码.
如何使用mechanize实现此行为?
我尝试使用ruby selenium webdriver运行一些基本的自动化测试.相同的代码在我的家用计算机上完美运行,但在代理后面的工作计算机上失败(不需要身份验证).
driver = Selenium :: WebDriver.for:firefox,:profile =>'default'
我得到的错误是:
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/remote/http/common.rb:66:in `create_response': unexpected response, code=
403, content-type="text/html" (Selenium::WebDriver::Error::WebDriverError)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>ERROR: The requested URL could not be retrieved</TITLE>
<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
</HEAD><BODY>
<H1>ERROR</H1>
<H2>The requested URL could not be retrieved</H2>
<HR noshade size="1px">
<P>
While trying to retrieve the URL:
<A HREF="http://127.0.0.1:7055/hub/session">http://127.0.0.1:7055/hub/session</A>
<P>
The following error was encountered:
<UL>
<LI>
<STRONG>
Access Denied.
</STRONG>
<P>
Access control configuration prevents your request …Run Code Online (Sandbox Code Playgroud) 我有一个spring/jdbc/oracle 10g应用程序.Oracle服务器数据库时区设置为GMT + 2 JVM时区为GMT + 2(即使在我的情况下无关紧要).
我有一个执行一些日期操作的存储过程.问题是会话时区与数据库时区不同(GMT),即使我没有在我的代码/配置中明确设置会话时区.
据我所知,会话时区默认等于数据库时区.知道为什么会话时区与数据库时区不同,或者如何在spring配置中配置它(org.apache.commons.dbcp.BasicDataSource)?
谢谢.
我目前正在开发一个单页javascript应用程序,使用服务器端的Sinatra Ruby和客户端的Backbone.js,jQuery,jQuery UI.应用程序的主要目的是允许客户查看/编辑不同类型的项目,每个项目视图是一种或多或少复杂的形式.
为了确保一切正常,我打算做:
在这种情况下,您建议使用哪些框架/工具进行集成测试?我从Selenium开始,但我不太喜欢它.我刚开始看看PhantomJS和CasperJS,他们看起来非常适合浏览,点击链接等基本内容......
你的建议是什么?