Skip to content

Instantly share code, notes, and snippets.

@chensoren
chensoren / nginx_subdomain.md
Last active August 29, 2015 14:03
解决redirect_to跳转丢失子域名

问题描述

使用redirect_to跳转时子域名丢失,比如跳转到subdomain.example.com/admins/users时nginx会帮你解析到subdomain.example.com/admins/.example.com/admins/users

解决方法

在nginx配置文件里面添加如下代码

proxy_redirect off;

@chensoren
chensoren / bbs.md
Created March 14, 2014 08:51
不错的开源问答论坛
@chensoren
chensoren / rails_practical_codes.md
Created March 10, 2014 02:03
Rails 实用代码

block assign

User.where(email: '[email protected]').first_or_initialize.tap do |admin_u|
  admin_u.is_admin = true
  admin_u.first_name = 'Admin'
  admin_u.last_name = 'User'
  admin_u.user_type = 'admin'
  admin_u.save!
end

创建用户

CREATE USER 'usuario'@'localhost' IDENTIFIED BY 'contraseña';

创建数据库

CREATE DATABASE mydatabase CHARACTER SET utf8

授权

@chensoren
chensoren / startup.md
Created March 4, 2014 08:12
startup resource
@chensoren
chensoren / debian_server.md
Last active August 29, 2015 13:56
debian command
@chensoren
chensoren / magento.md
Last active August 29, 2015 13:56
magento 后台管理

magento安装权限问题

find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 777 {} \;
chmod o+w var var/.htaccess app/etc
chmod 550 mage
chmod -R o+w media
chmod -R 777 var/
@chensoren
chensoren / sublime_plugin.md
Last active January 2, 2016 16:28
Sublime Text 插件 #sublime