2009年9月27日日曜日

Apacheでファイル一覧を表示させない

# vi /etc/httpd/conf/httpd.conf

Options Indexes FollowSymLinks

Options -Indexes FollowSymLinks

# /etc/init.d/httpd restart

2009年9月23日水曜日

サーバー設定(3)

[1] MySQLインスト&設定

# yum -y install mysql-server
# /etc/rc.d/init.d/mysqld start

# chkconfig mysqld on
# chkconfig --list mysqld

mysql_secure_installation ←インストール直後の設定を自動的にしてくれる
全部エンター。途中でrootのパス設定だけする。

これをしたら
↓ココから↓

# mysql -u root

mysql> select user,host,password from mysql.user; ←userとhostを確認

全てのrootユーザーにパス設定をする

mysql> SET PASSWORD FOR root@localhost=PASSWORD('パスワード');
mysql> SET PASSWORD FOR root@example.com=PASSWORD('パスワード');
mysql> SET PASSWORD FOR root@127.0.0.1=PASSWORD('パスワード');

mysql> select user,host,password from mysql.user; ←パス設定されたか確認

mysql> delete from mysql.user where user=""; ←無名ユーザー削除

↑ココまで↑
はしなくてOK


全てのDBに全てのアクセス権限を持った新規ユーザー(ユーザ:satoru パスワード:12345)を作成

mysql> grant all privileges on *.* to satoru@localhost identified by '12345';



# vi /etc/my.cnf ← MySQLの設定

datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
default-character-set=ujis ←今はutf8が主流
skip-character-set-client-handshake
query_cache_size=8M
key_buffer_size=100M

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[mysql]
default-character-set=ujis ←今はutf8が主流

[mysqldump]
default-character-set=ujis ←今はutf8が主流

# /etc/init.d/mysqld restart


[2] phpMyAdminインスト&設定

■さくらvpsでphpmyadminのインストール

yum -y install phpmyadmin
cp /etc/httpd/conf.d/phpMyAdmin.conf /etc/httpd/conf.d/phpMyAdmin.conf.org
vi /etc/httpd/conf.d/phpMyAdmin.conf


<Directory /usr/share/phpMyAdmin/>
   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
       Require ip 127.0.0.1
       Require ip ::1
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from 127.0.0.1
     Allow from ::1
     Allow from .ocn.net ←ホスト名で許可。自宅IPでもOK
   </IfModule>
</Directory>
  


http://IP/phpmyadmin

rootでログイン






■phpMyAdminインストール&設定

# cd /usr/local/src
# wget http://prdownloads.sourceforge.net/phpmyadmin/phpMyAdmin-2.11.9.6-all-languages.tar.gz?download
*最新バージョンなどはhttp://www.phpmyadmin.net/home_page/downloads.phpで探す
# tar zxfv phpMyAdmin-2.11.9.6-all-languages.tar.gz
# mv phpMyAdmin-2.11.9.6-all-languages /var/www/phpMyAdmin

設定ファイル phpMyAdmin.conf の編集
# vi /etc/httpd/conf.d/phpMyAdmin.conf

Alias /phpMyAdmin /var/www/phpMyAdmin

<location /phpMyAdmin>
Order deny,allow
Deny from all
Allow from 127.0.0.1
Allow from ***.***.***.***
</location>

※***.***.***.***はアクセス元のIPアドレス
あるいは、xxx.ocn.ne.jpのホスト名

Apache 再起動前のテスト
# /etc/init.d/httpd configtest

Syntax OK

Apache 再起動
# /etc/init.d/httpd reload

httpd を再読み込み中: [ OK ]

ブラウザより設定ファイル作成の前の準備
# cd /var/www/phpMyAdmin/
# mkdir config
# chmod o+rw config
# cd config
# touch config.inc.php
# chmod o+w config.inc.php

ブラウザより設定ファイル作成
http://【ホスト名】/phpMyAdmin/scripts/setup.php

Servers の右にある「add」ボタン押下の直後
・Authentication type cookie を選択
・User for config auth = ID を入力
・Password for config auth = パスワード を入力
・add ボタンを押下します。
・Configuration の [Save] ボタンを押下します。

Features の [Security] ボタン
・Force SSL connection にチェック
・Recall user name にチェック
・Update ボタンを押下します。
・Configuration の [Save] ボタンを押下します。

Features の [Charsets] ボタン
・Default charset で utf-8 を選択
・Update ボタンを押下します。
・Configuration の [Save] ボタンを押下します。

設定ファイルをコピー
# cp config.inc.php ../

ブラウザより動作確認
http://【ホスト名】/phpMyAdmin/

引用元 : MAKIZOU.COM


mcrypt 拡張をロードできません。PHP の設定を確認してください

# yum -y install php-mcrypt

phpMyAdminにログインできない

キャッシュが残ってる?
ブラウザを変えてみる。ローカルPCを再起動など

2009年9月21日月曜日

サーバー設定(2)

[1] Apacheインスト&設定

# yum -y install httpd
# yum -y install php php-devel php-mysql php-mbstring php-gd php-pear
#cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.org
# vi /etc/httpd/conf/httpd.conf

# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None

AllowOverride All ← .htaccessの許可

Options Indexes FollowSymLinks

Options -Indexes FollowSymLinks ←Apacheでファイル一覧を表示させない 。-をつけるだけ

AddDefaultCharset UTF-8

#AddDefaultCharset UTF-8 ← コメントアウト

#NameVirtualHost *:80

NameVirtualHost *:80 (← バーチャルドメイン設定 行頭にある # を削除)


ServerName www.example.com
ServerAlias example.com
DocumentRoot /var/www/html/example.com


# mkdir /var/www/html/example.com
# chown ftpuser /var/www/html/example.com(← ftpユーザーのアクセスを可能に)

service httpd reload

# chkconfig httpd on ← httpd自動起動設定
# chkconfig --list httpd ← 確認


[2] Vsftpdインスト&設定

*winSCPでSFTPするときはVsftpd不要

# yum -y install vsftpd
# vi /etc/vsftpd/vsftpd.conf 

anonymous_enable=NO ← 匿名ユーザのログイン禁止
ascii_upload_enable=YES ← 行頭にある # を削除
ascii_download_enable=YES ← 行頭にある # を削除
ls_recurse_enable=YES ← 行頭にある # を削除 (ディレクトリごと削除)
use_localtime=YES ← 追加 (タイムスタンプを日本時間に)
force_dot_files=YES ← 追加 (.htaccessを表示)


# service vsftpd start
# chkconfig vsftpd on ← vsftpd自動起動設定
# chkconfig --list vsftpd ← 設定確認

サーバー設定(1)

[1] rootのパスを変更
# passwd root

[2] ユーザーアカウント作成 (例. admin)
# useradd admin
# passwd admin

[3] FTPアカウント作成 (例. ftp)
→ sshになれないように
# useradd -s /sbin/nologin ftp
# passwd ftp

[4] rootでSSH接続禁止
# vi /etc/ssh/sshd_config
PermitRootLogin no (行頭にある # を削除)
# service sshd reload

[5] アクセス制限
# vi /etc/hosts.deny
ALL:ALL
*全て拒否した上で
# vi /etc/hosts.allow
ALL:127.0.0.1
ALL:.xxx.ocn.ne.jp
*上記IPとリモートホストを許可
SSHだけだったらsshd:
SSH&FTPだったらALL:

[6] 自動起動設定変更
sshをon
# chkconfig sshd on
# chkconfig --list

sendmailをoff
(監視スクリプトで使用する場合はonのまま)
# chkconfig sendmail off
# chkconfig --list

2009年9月19日土曜日

paypal自動支払いをキャンセル

Cancelling Recurring PaymentsYou may cancel a Recurring Payment at any time up to 3 working days prior to the date the payment is scheduled to take place. If your payment is funded by your bank account, then you may cancel this payment following notice of the payment to be made by contacting PayPal customer support via email or telephone. To cancel a Recurring Payment generally, log into your account, access the “My Account” tab, then access the “Profile” tab, the access the “Financial Information” column and click on “Billing Agreements” and follow the instructions to cancel the payment. If your Recurring Payment is not in this column, then access the “History” tab instead of the “Profile” tab and access “Subscriptions” and follow the directions to cancel the payment. Recurring Payments are sometimes referred to as “subscriptions” or “preapproved payments”. If you cancel a Recurring Payment you may still be liable to the merchant for the payment and be required to pay the merchant through alternative means.

puttyでコピペ

左クリック範囲選択して離すとコピー
右クリックでペースト
valuedomainのデフォルトDNS設定フィールド

a * 123.456.78.90
mx @ 10
txt @ v=spf1 ip4:123.456.78.90 ~all