ユーザーを追加する
ヒント
ユーザー名、パスワード、ドメイン名を入力して更新ボタンをクリックしてください。
VALUE-DOMAIN等で取得したドメインのDNS設定をしてください。
ユーザー追加
[root@centos ~]# useradd
[root@centos ~]# passwd
Changing password for user .
New password: ←ユーザーのパスワード入力
BAD PASSWORD: The password contains the user name in some form
Retype new password: ←パスワード再入力
passwd: all authentication tokens updated successfully.
[root@centos ~]# chmod 701 /home/
Apache設定
[root@centos ~]# vi /etc/httpd/conf.d/virtual.conf
↓下記を記入
<VirtualHost *:80>
ServerName
DocumentRoot /home//public_html
<Directory "/home//public_html">
Options Includes ExecCGI FollowSymLinks
</Directory>
ErrorLog /var/log/httpd/-error_log
CustomLog /var/log/httpd/-access_log combined env=!nolog
</VirtualHost>
[root@centos ~]# systemctl reload httpd
Let's Encrypt
[root@centos ~]# certbot certonly --webroot -w /home//public_html -d
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator webroot, Installer None
Starting new HTTPS connection (1): acme-v02.api.letsencrypt.org
Requesting a certificate for centos.org
Performing the following challenges:
http-01 challenge for centos.org
Using the webroot path /home/centos/public_html for all unmatched domains.
Waiting for verification...
Cleaning up challenges
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/centos.org/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/centos.org/privkey.pem
Your certificate will expire on 2021-05-21. To obtain a new or
tweaked version of this certificate in the future, simply run
certbot again. To non-interactively renew *all* of your
certificates, run "certbot renew"
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le
バーチャルホスト設定
[root@centos ~]# vi /etc/httpd/conf.d/virtual-le-ssl.conf
<VirtualHost *:443>
ServerName :443
ServerAlias www.
DocumentRoot /home//public_html
SSLCertificateFile /etc/letsencrypt/live//cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live//privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live//chain.pem
<Directory "/home//public_html">
Options Includes ExecCGI FollowSymLinks
</Directory>
</VirtualHost>
[root@centos ~]# systemctl reload httpd
MySQL設定
[root@centos ~]# mysql -u root -p
Enter password: ←パスワード入力
MariaDB [(none)]> CREATE DATABASE ; ←新規データベースを作成
Query OK, 1 row affected (0.01 sec)
MariaDB [(none)]> GRANT ALTER,CREATE,DELETE,DROP,INSERT,LOCK TABLES,SELECT,UPDATE ON .* TO @localhost IDENTIFIED BY ''; ←新規ユーザーを作成
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> EXIT;
Postfix設定(バーチャルドメイン追加)
[root@centos ~]# vi /etc/postfix/virtual
↓最終行に下記を記入
anything
postmaster@
[root@centos ~]# postmap /etc/postfix/virtual
[root@centos ~]# systemctl reload postfix
メールアドレス追加 (専用ユーザーでSMTP認証する場合)
[root@centos ~]# saslpasswd2 -u server-manual.com -c postmaster@
Password: ←パスワード入力
Again (for verification): ←パスワード再入力
[root@centos ~]# sasldblistusers2 ←メールユーザー確認
postmaster@: userPassword
ヒント
-uオプションのドメインは/etc/postfix/main.cfの「mydomain」で設定したドメインと同じにしてください。
削除する場合は、saslpasswd2 -u realm(ドメイン名) -d ユーザー名
vsftpd設定
[root@centos ~]# echo >> /etc/vsftpd/chroot_list