Archive for the ‘server’ Category

 

さくらのVPSでローカル接続してみました。 1Gbpsベストエフォート : centos

11月 4th, 2013

さくらのVPSでローカル接続をやってみました。 http://support.sakura.ad.jp/manual/vps/mainte/local.html に従って、以下の手順でOKでした。 1. スイッチの作成 コントロールパネル>サーバー一覧>ネットワーク>追加 で ゾーンを選択して(石狩第1 適当な名前でスイッチを作成しました。 2. サーバーに割り当てる *注意点としては、サーバーをシャットダウンした状態でないとこの作業は出来ません 該当サーバーをシャットダウンしてから サーバー>該当サーバーの「接続設定」 eth1に1で作成したスイッチを設定 今回は2台 3. サーバーのネットワーク設定 # ifconfig -a eth0 , loだけだったのが eth1 , eth2が増えているのを確認。 /etc/sysconfig/network-scripts/ifcfg-eth1 GATEWAYはeth0 DEVICE=”eth1″ IPADDR=”192.168.101.152″ NETMASK=”255.255.0.0″ BROADCAST=”192.168.255.255″ ONBOOT=”yes” TYPE=”Ethernet” こんな感じで、eth0と間違えると当然接続出来なくなるので注意。 # /etc/rc.d/init.d/network status Configured devices: lo eth0 eth1 Currently active devices: lo eth0 # /etc/rc.d/init.d/network reload Shutting down interface […]

Read full article | コメントは受け付けていません。

nginx get parameterをrewrite

10月 28th, 2013

location ~ ^/search { # http://sample.com/search_sp?search=iphone5s rewrite ^/search_sp(.*) /bid/$arg_search permanent; } これです。パラメータはarg_{key}で取れるという。凄い機能でした。 $argだと全部ついてくるようです。

Read full article | コメントは受け付けていません。

nginx x fastcgi 504 Gateway timeout

10月 12th, 2013

nginx と php-fpmで504が出た時。 php.ini max_execution_time = 60 php-fpm request_terminate_timeout 0 nginx fastcgi_read_timeout 60s んーデフォルト60秒らしいけど、60sも経ってるかな?一応

Read full article | コメントは受け付けていません。

別のブランチから特定のファイルのみ持ってくる

10月 4th, 2013

特定のコミットをマージするには、cherry-pickやパッチですが mergeした際にconflictしてファイルとディレクトリの名前が被っていたので・・・ conf/memcachedをgit rm -rで一旦mergeのときは削除しておきました。 その後、別ブランチから特定のファイルのみcheckoutしました。 $ git checkout dev conf/memcached $ git status # On branch master # Your branch is ahead of ‘origin/master’ by 12 commits. # # Changes to be committed: # (use “git reset HEAD …” to unstage) # # new file: conf/memcached/memcached # new file: conf/memcached/memcached.backend # new file: conf/memcached/memcached.category […]

Read full article | コメントは受け付けていません。

nginx rewrite

8月 31st, 2013

nginx で rewrite ファイルが無いときだけ、phpに渡す方法 server {  listen       20961;  root /home/www/web_api;  access_log   /var/log/nginx/com.access.log  main;  error_log   /var/log/nginx/com.error.log;  location /bid/ {    index   index.php index.html;    try_files $uri @rewriteapp;  }  location @rewriteapp{    rewrite ^/(.*)$ /index.php last;  }  location /index.php {    fastcgi_pass unix:/var/run/php-fpm/www.socket;    fastcgi_index index.php;    include fastcgi_params;  } } […]

Read full article | コメントは受け付けていません。

php-fpm + nginx

8月 31st, 2013

fpm socket or tcp http://lowendtalk.com/discussion/7289/nginx-php-fpm-unix-socket-or-tcp-ip-for-fastcgi-pass https://github.com/perusio/php-fpm-example-config 5.3.8まではtcpのほうが良い? http://wiki.nginx.org/PHPFcgiExample /etc/php-fpm.d/www.conf php 5.4.19なので tcpをsocketにしてみる。 ; listen = 127.0.0.1:9000 listen = /var/run/php-fpm/www.socket apacheをnginxに変更 user = nginx ; RPM: Keep a group allowed to write in log dir. group = nginx # /etc/init.d/php-fpm start Starting php-fpm: [ OK ] でエラーが出なければOK * phpのいろいろ更新したのでエラーが出た、ライブラリを再構築しました。 /etc/nginx/fastcgi_params fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name; fastcgi_param  PATH_INFO […]

Read full article | コメントは受け付けていません。

screen maxwin ウィンドウ数を制限する。

8月 22nd, 2013

maxwinのデフォルトは40らしい。 開発環境のopenvzが8接続しか出来ないので、screenでたくさん開いて切れるとつなげなくなるので、止めておく。 screen ctrl+a :maxnum 5 で、5個以上windowを生成出来なくなる == /etc/security/limits.conf maxloginsも設定しておく @users – maxlogins 7 usersは 7までしかログイン出来なくしておく。 screen の maxnumをしてなくてもこの上限となる。

Read full article | コメントは受け付けていません。

sftp: sshでログインさせず、特定ディレクトリのみ利用させる

7月 19th, 2013

/etc/ssh/sshd_conf Subsystem       sftp    internal-sftp Match AllowGroups sftpuser        ChrootDirectory /home/sftpuser/%u/data        X11Forwarding no        AllowTcpForwarding no        PasswordAuthentication yes        ForceCommand internal-sftp とりあえず sftpuserグループの人は、それぞれのディレクトリ のsftpdataに書き込めるように設定する必要がある。

Read full article | コメントは受け付けていません。

ファイルサイズ関連

7月 19th, 2013

* nginx  client_max_body_size 16M; * httpd , php  LimitRequestBody 1000000  php_value  upload_max_filesize  16M  php_value post_max_size 16M  php_value max_execution_time 60  php_value max_input_time 60 * form この辺

Read full article | コメントは受け付けていません。

denyhosts

7月 6th, 2013

http://denyhosts.sourceforge.net/ epalでインストール yum install denyhosts いないユーザーで試されたら一発で拒否。rootも一発 DENY_THRESHOLD_INVALID = 1

Read full article | コメントは受け付けていません。