我希望我的nginx make显示所有url的干净.
通过一些研究,我已经将第一个案例付诸实践.它通过以下配置完成:
location / {
root html;
index index.html index.htm index.php;
try_files $uri.html $uri/ =404;
}
Run Code Online (Sandbox Code Playgroud)
它适用于indexhtml.html显示为indexhtml,但.php没有任何反应.如果我将$ uri.html更改为$ uri.php,它既不适用于.html,也不适用于.php.我试图在php位置添加类似的东西,但没有任何成功.
有什么建议吗?
我试图打开时收到此错误消息
/app_dev.php
An error occurred while loading the web debug toolbar (404: Not Found).
Do you want to open the profiler?
Run Code Online (Sandbox Code Playgroud)
当我点击确定时,我收到错误:
app_dev.php/_profiler/5053258a822e1
Run Code Online (Sandbox Code Playgroud)
和
404 Not found
Run Code Online (Sandbox Code Playgroud)
我正在使用nginx
非常感谢您的帮助.
编辑:这是错误日志:
[error] 18369#0: *9 open() "/var/www/Symfony/web/app_dev.php/_wdt/5056f875afc98" failed (20: Not a directory), client: 127.0.0.1, server: symfony, request: "GET /app_dev.php/_wdt/5056f875afc98 HTTP/1.1", host: "symfony", referrer: "http://symfony/app_dev.php"
[error] 18369#0: *9 open() "/var/www/Symfony/web/404" failed (2: No such file or directory), client: 127.0.0.1, server: symfony, request: "GET /app_dev.php/_wdt/5056f875afc98 HTTP/1.1", host: "symfony", referrer: "http://symfony/app_dev.php"
Run Code Online (Sandbox Code Playgroud)
编辑2:
当我尝试访问app_dev.php页面打开但没有工具栏时,当我尝试使用app_dev.php /我得到了
**Oops! …Run Code Online (Sandbox Code Playgroud) 我想在我的网站上使用javascript打开一个新的银行支付标签,并且没有主窗口导航,
当用户从银行支付回到返回URL时,我想从另一个窗口检测返回URL的回复(如果可能)或只是通知主窗口该事务已完成并应检查数据库更新.
我在几个网站上看到过这种行为,比如popup->login->popup closes->main window reloads加载会话,问题是我不知道这个方法叫什么,所以我不知道我在找什么关键字.
我真正需要的是这个方法的名称,或者它是如何完成的(作为javascript中的某个关键字或其他东西)
提前致谢
当我试图在Ruby Mine中的Rails应用程序(2.1.3)上运行调试器时,我收到以下错误:
> /home/vladimirn/.rvm/rubies/ruby-2.1.3/bin/ruby /home/vladimirn/.rvm/gems/ruby-2.1.3/gems/ruby-debug-ide-0.4.23.beta1/bin/rdebug-ide --disable-int-handler --port 38013 --dispatcher-port 33518 -- /home/vladimirn/Dev/Projects/untitled/bin/rails server -b 0.0.0.0 -p 3000 -e development
/home/vladimirn/.rvm/rubies/ruby-2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- debase_internals (LoadError)
from /home/vladimirn/.rvm/rubies/ruby-2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/vladimirn/.rvm/gems/ruby-2.1.3/gems/debase-0.0.9/lib/debase.rb:4:in `<top (required)>'
from /home/vladimirn/.rvm/rubies/ruby-2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/vladimirn/.rvm/rubies/ruby-2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/vladimirn/.rvm/gems/ruby-2.1.3/gems/ruby-debug-ide-0.4.23.beta1/lib/ruby-debug-ide.rb:8:in `<top (required)>'
from /home/vladimirn/.rvm/gems/ruby-2.1.3/gems/ruby-debug-ide-0.4.23.beta1/bin/rdebug-ide:8:in `require_relative'
from /home/vladimirn/.rvm/gems/ruby-2.1.3/gems/ruby-debug-ide-0.4.23.beta1/bin/rdebug-ide:8:in `<main>'
Process finished with exit code 1
Run Code Online (Sandbox Code Playgroud)
看起来问题在于debase gem.当我试图删除它并重新安装RubyMine时,我得到以下内容:
> error running Development: untitled: Failed to Install Gems. Following gems were not installed: /home/vladimirn/Dev/RubyMine-6.3.3/rb/gems/debase-0.0.9.gem: Error installing debase-0.0.9.gem: ERROR: Failed to …Run Code Online (Sandbox Code Playgroud) 所以我试着按照这里的教程:http://guides.rubyonrails.org/getting_started.html
我对于发生了什么有一些想法,但是在这一点上,我正变得越来越沮丧,并且无法以一种有意义的方式看待这一点.我的控制器目前在哪里.这很简单,我以为我知道发生了什么:
articles_controller.rb
class ArticlesController < ApplicationController
def new
end
def create
@article = Article.new(article_params)
@article.save
redirect_to @article
end
private
def article_params
params.require(:article).permit(:title, :text)
end
end
Run Code Online (Sandbox Code Playgroud)
的routes.rb
Rails.application.routes.draw do
get 'welcome/index'
Rails.application.routes.draw do
resource :articles
root 'welcome#index'
end
end
Run Code Online (Sandbox Code Playgroud)
但我现在已经超出了我的深度,无法继续下去.如果它有所作为我正在运行Windows 8专业版.任何帮助,将不胜感激.我可以告诉错误与'redirect_to'有关,但除此之外我什么都不知道!我的错误现在看起来像:
NoMethodError in ArticlesController#create
undefined method `article_url' for #<ArticlesController:0x979bfc0>
Extracted source (around line #0):
app/controllers/articles_controller.rb:9:in `create'
Run Code Online (Sandbox Code Playgroud)
堆栈跟踪看起来像这样:
actionpack (4.2.0) lib/action_dispatch/routing/polymorphic_routes.rb:268:in `handle_model_call'
actionpack (4.2.0) lib/action_dispatch/routing/url_for.rb:167:in `url_for'
actionpack (4.2.0) lib/action_controller/metal/redirecting.rb:95:in `_compute_redirect_to_location'
turbolinks (2.5.3) lib/turbolinks/xhr_headers.rb:21:in `_compute_redirect_to_location'
actionpack (4.2.0) lib/action_controller/metal/redirecting.rb:75:in `redirect_to' …Run Code Online (Sandbox Code Playgroud) 在这两个轨道2和Rails 3中,如果:自动保存=>真的has_many关联,收集通过循环和保存(:验证=>假)被称为在每个子关联.这是为什么?我们需要一个before_validation回调来为该子对象运行,但它不会,因为它是一个跳过验证的保存.
这有什么好办法?跳过验证的目的是什么?
任何帮助将非常感激!谢谢!
我正在尝试使用mysqldump从我的Amazon RDS实例中检索数据库,例如
mysqldump –h myDBname.cra3xhjrgj69.eu-west-1.rds.amazonaws.com -u root –p --port 3306 --single-transaction --databases DBname > ~/tt.sql
Run Code Online (Sandbox Code Playgroud)
但是我收到错误:
mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) when trying to connect
Run Code Online (Sandbox Code Playgroud)
我可以使用客户端连接到数据库:
mysql --host=myDBname.cra3xhjrgj69.eu-west-1.rds.amazonaws.com -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 85250
Server version: 5.1.69-log MySQL Community Server (GPL)
Run Code Online (Sandbox Code Playgroud)
我也检查了root权限:
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, PROCESS, REFERENCES, INDEX, ALTER, SHOW …Run Code Online (Sandbox Code Playgroud) 我有一堆子域名http://product.domain.com,我想重定向到http://www.domain.com/product.
当然,产品名称可以不同,并且必须相应地进行重定向.
有什么指针吗?
谢谢
在视图中
= form.collection_check_boxes :category_ids, Item::Category.all, :id, :name, checked: "#{@search.try(:category_ids)}"
Run Code Online (Sandbox Code Playgroud)
回报
"[\"3\", \"\"]"
Run Code Online (Sandbox Code Playgroud)
但它应该产生
["3", ""]
Run Code Online (Sandbox Code Playgroud)
为什么会这样?
@search.try(:category_ids) is ["3", ""]
Run Code Online (Sandbox Code Playgroud) 我是NGINX的新手.从阿帕奇搬走了.在htaccess apapche它工作正常.我已经尝试了一些转换器,并没有像阿帕奇一样工作.一些转换器使用打破其他使用last.i尝试了很多小时.这是我的htaccess.谢谢
# 404 ERROR NOT FOUND PAGE
ErrorDocument 404 /404.php
# 301 REDIRECT add WWW
RewriteCond %{HTTP_HOST} ^website.com$ [NC]
RewriteRule ^(.*)$ http://www.website.com/$1 [r=301,nc]
# IP Canonicalization/ change IP to domain name
RewriteCond %{HTTP_HOST} ^111\.222\.333\.444
RewriteRule (.*) http://www.website.com/$1 [R=301,L]
# NO rewrite for exact file/folder name. ex: website.com/index.php and website.com/admin
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# modul. ex: website.com/news and website.com/news/page/3
RewriteRule ^([^/]+)/?$ index.php?mod=$1 [QSA,L]
RewriteRule ^([^/]+)/page/([0-9]+)/?$ index.php?mod=$1&page=$2 [QSA,L]
#detail content. ex: website.com/news/123/title-news.html or website.com/news/123/title-news or website.com/news/123
RewriteRule ^([^/]+)/([0-9]+)/[^/]+\.html$ …Run Code Online (Sandbox Code Playgroud)