LoginSignup
7
7

More than 5 years have passed since last update.

さくらVPS設定メモ

Posted at

さくらVPSの設定

  • 日本語化
    etc/sysconfig/i18n
    ja_JP.UTF-8

  • ユーザーを作成
    useradd yusuke
    passwd yusuke

  • yusukeをwheelグループに追加
    usermod -G wheel yusuke

  • wheelグループにroot権限を与える
    visudo

  • (このままだとid/passがばれるとまずい)鍵認証をつける

  • VPS側 mkdir ~/home/yusuke/.ssh
    chmod 700 .ssh/

  • mac側 scp ~/.ssh/id_rsa.pub yusuke@wwwさくらのURL.sakura.ne.jp:~/.ssh/authorized_keys

  • ssh yusuke@wwwさくらのURL.sakura.ne.jp

  • ポート番号の変更
    cp /etc/ssh/sshd_config /etc/ssh/sshd_config.org

  • パスワードログインの禁止
    vim /etc/ssh/sshd_config
    PasswordAuthentication no

  • rootログインの禁止
    vim /etc/ssh/sshd_config
    PermitRootLogin no

  • 再起動
    service sshd restart

  • ファイヤーウォールの設定をする
    vim /etc/sysconfig/iptables
    service iptables start

  • webサーバーの設定
    yum install httpd
    chkconfig hpptd on
    cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.org
    vim /etc/httpd/conf/httpd.conf
    /ServerTokens Prod
    /ServerSignature Off
    /Options -Indexes FollowSymLinks
    service httpd configtest
    service httpd start

  • ドキュメントルートをyusukeユーザーでもつくれるように
    chown -R yusuke:yusuke /var/www/html/

  • VirtualHostの設定
    mkdir -p /var/www/dev.example.com/public_html
    chown -R yusuke:yusuke /var/www/dev.example.com/public_html/
    vim /etc/httpd/conf.d/dev.example.com.conf
    service httpd configtest
    service httpd restart
    vim /var/www/dev.example.com/public_html/index.html

  • PHPの設定
    yum install php php-devel php-mysql php-gd php-mbstring
    php -v
    cp /etc/php.ini /etc/php.ini.org
    vim /etc/php.ini
    error_log = /var/log/php_errors.log
    mbstring.language = Japanese 有効
    mbstring.internal_encoding = UTF-8
    mbstring.http_input = auto 有効
    mbstring.detect_order = auto 有効
    expose_php = off
    date.timezone = Asia/Tokyo
    service httpd restart

  • MySQLの設定
    yum install -y mysql-server
    cp /etc/my.cnf /etc/my.cnf.org
    vim /etc/my.cnf
    service mysqld start
    mysql_secure_installation
    chkconfig mysqld on
    mysql -u root -p

7
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
7