Proxy(認証あり)の通り方まとめ
yum
/etc/yum.conf
:
proxy=http://<Proxyサーバ>:<Port番号>/
proxy_username=<ユーザ名>
proxy_password=<パスワード>
wget
~/.wgetrc
use_proxy = on
proxy_user = <ユーザ名>
proxy_passwd = <パスワード>
http_proxy = http://<Proxyサーバ>:<Port番号>/
https_proxy = http://<Proxyサーバ>:<Port番号>/
ftp_proxy = http://<Proxyサーバ>:<Port番号>/
Subversion
~/.subversion/servers
http-proxy-host = <Proxyサーバ>
http-proxy-port = <Port番号>
http-proxy-username = <ユーザ名>
http-proxy-password = <パスワード>
curl
curl -x <Proxyサーバ>:<Port番号> -U <ユーザ名>:<パスワード> -O
Apache Bench
$ ab -n <合計アクセス数> -c <同時アクセス数> -X '<Proxyサーバ>:<Port番号>' -P '<ユーザ名>:<パスワード>' <対象URL>
CPAN (Perl)
$ perl -MCPAN -e shell
cpan> o conf ftp_proxy http://<Proxyサーバ>:<Port番号>/
cpan> o conf http_proxy http://<Proxyサーバ>:<Port番号>/
cpan> o conf proxy_user <ユーザ名>
cpan> o conf proxy_pass <パスワード>
cpan> o conf commit
Pear (PHP)
$ pear config-set http_proxy http://<ユーザ名>:<パスワード>@<Proxyサーバ>:<Port番号>/
gem (Ruby)
$ gem install <パッケージ名> --http-proxy http://<Proxyサーバ>:<Port番号>@<ユーザ名>:<パスワード>/
easy_install(Python?)
$ export HTTP_PROXY='<Proxyサーバ>:<Port番号>@<ユーザ名>:<パスワード>'
$ easy_install
さくらVPSでメール送信専用サーバ構築
インストール
$ yum install postfix
postfix設定
$ vim /etc/postfix/main.cf ----- #myhostname = foo.bar.com myhostname = testhost.com : #mydomain = foo.bar.com mydomain = testhost.com : #myorigin = $mydomain myorigin = $mydomain : : (ファイル末尾に追記) # SMTP-Auth configuration smtpd_sasl_auth_enable = yes smtpd_sasl_local_domain = $myhostname smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination # limit message_size_limit = 10485760
認証デーモン起動&自動起動設定
$ sudo /etc/rc.d/init.d/saslauthd start $ sudo /sbin/chkconfig saslauthd on $ sudo /sbin/chkconfig --list saslauthd # saslauthd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Postfix起動&自動起動設定
$ sudo /etc/rc.d/init.d/postfix start $ sudo /sbin/chkconfig postfix on $ sudo /sbin/chkconfig --list postfix # postifx 0:off 1:off 2:on 3:on 4:on 5:on 6:off
opensslをソースからインストール
tar玉をダウンロード&解凍
$ wget http://www.openssl.org/source/openssl-1.0.1g.tar.gz $ tar xvfz openssl-1.0.1g.tar.gz $ cd openssl-1.0.1g
# 最新Ver. → http://www.openssl.org/source/
コンパイルオプション設定
$ ./config --prefix=/usr
インストール
$ make $ make test $ make install clean
Macで「お使いの起動ディスクはほとんど一杯です」が出た場合の対処法
一般的?な対処法はいかに記載されてる。
ハードディスクの空き容量が極端に少なくなる場合の対処方法 | Apple サポートコミュニティ
Macにウィルスバスターを利用している場合は、「/cores/」にダンプファイルが大量に作成されていることがあるようなのでそれを削除すればサクッと解決する。
なんで、ダンプファイルが作成されるのか?作成されなくする方法は誰か教えてくださいm(_ _)m
cd /cores/ sudo rm -f *
さくらVPS借りたらまず最初にやること(サーバ起動〜ログインまで)
VPSコントロールパネルにログインする
契約後、数分すると「仮登録完了のお知らせ」というメールが届く。
そのメールに記載されている、IPアドレスがサーバのIPアドレス。
ただし、サーバは起動していないので、VPSコンソールからサーバを起動する必要がある。
VPSコントロールパネルにログイン
https://secure.sakura.ad.jp/vpscontrol/
※メールに記載のIPアドレスとパスワードでログインする。
サーバを起動する
「VPSホーム」メニューにある、「仮想サーバ操作」から「起動」を選択する。
※サーバが起動するまでに数分かかります。
SSHでサーバにログインする
$ <メールに記載のrootパスワード>
EC2の時間をJSTに変更する
EC2の時間を日本時間(JST)にする
$ rm /etc/localtime $ ln -s /usr/share/zoneinfo/Japan /etc/localtime
EC2でMySQLサーバ構築
- Mysqlインストール
$ sudo yum install mysql-server
- Mysql初期設定
$ vi /etc/my.cnf ----- [mysqld] : character-set-server = utf8 -----
- Mysql起動&自動起動
$ /etc/rc.d/init.d/mysqld start $ chkconfig mysqld on
- ユーザ作成
$ mysql -u root mysql> use mysql; mysql> GRANT ALL PRIVILEGES ON *.* TO ユーザ名@localhost IDENTIFIED BY 'パスワード' WITH GRANT OPTION; mysql> GRANT ALL PRIVILEGES ON *.* TO ユーザ名@'%' IDENTIFIED BY 'パスワード' WITH GRANT OPTION; mysql> flush privileges;
- rootユーザなど削除
mysql> delete from users where user='root'; mysql> delete from users where password=''; mysql> flush privileges;
cakephpで同一SQLを複数回発行する
CakePHPは親切なので、全く同じSELECT文を発行した場合、
SQLを実行せず、キャッシュから結果を返してくれます。
場合によってはキャッシュされた結果を使いたくない時もあるので、
そのような場合は以下のようにします。
while(1) { // 実行したいSQL $sql = "SELECT * FROM table WHERE column = ? FOR UPDATE; // バインド機能使おうね $bind = $hoge . $uge; // 第三引数でキャッシュしないように指定 $this->Model->fetchAll($sql, array($bind), array('cache'=>false)); }
ちなみにCakePHP2.xで試しました。