CentOS 7にApacheをインストールする方法
CentOS 7サーバーにApache 2.4をインストールする方法を説明します。安定したウェブサーバーを構築するための前提条件と手順を解説します。
YOURLS(Your Own URL Shortener)は、オープンソースのURL短縮およびデータ分析アプリケーションです。
この記事では、CentOS 7サーバーにYOURLSをインストールするプロセスについて説明します。
example.com
サーバーのIPアドレスを指すドメイン。sudoユーザーとしてログインし、以下のコマンドを使用してシステムを更新します。
sudo yum install epel-release -y
sudo yum clean all && sudo yum update -y && sudo shutdown -r now
再起動後、同じsudoユーザーを使用してサーバーに再度ログインします。
YUMを使用してApache Webサーバーをインストールします。
sudo yum install httpd -y
Apacheウェルカムページを削除します。
sudo sed -i 's/^/#&/g' /etc/httpd/conf.d/welcome.conf
Apacheが訪問者のWebブラウザーでファイルを公開しないようにします。
sudo sed -i "s/Options Indexes FollowSymLinks/Options FollowSymLinks/" /etc/httpd/conf/httpd.conf
Apacheサービスを開始し、システムの起動時に自動起動するように設定します。
sudo systemctl start httpd.service
sudo systemctl enable httpd.service
以下のように、MariaDBの最新の安定リリースであるMariaDB 10.1をインストールします。
cat <<EOF | sudo tee -a /etc/yum.repos.d/MariaDB.repo
# MariaDB 10.1 CentOS repository list - created 2017-01-14 03:11 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF
sudo yum install MariaDB-server MariaDB-client -y
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service
sudo /usr/bin/mysql_secure_installation
以下の質問に答え、独自のMariaDBルートパスワードを使用するようにしてください。
Enter
ボタンを押すだけY
your-root-password
your-root-password
Y
Y
Y
Y
MySQLシェルに次のようにログインしますroot
。
mysql -u root -p
独自のMariaDBルートパスワードを入力して、を押しEnter
ます。
MySQLシェルで、データベースyourls
、データベースユーザーyourlsuser
、およびデータベースユーザーのパスワードyourpassword
を次のように作成します。
注:セキュリティ上の理由から、サンプルのパスワードではなく、独自のユーザーパスワードを使用してくださいyourpassword
。
CREATE DATABASE yourls DEFAULT CHARACTER SET UTF8 COLLATE utf8_unicode_ci;
CREATE USER 'yourlsuser'@'localhost' IDENTIFIED BY 'yourpassword';
GRANT ALL PRIVILEGES ON yourls.* TO 'yourlsuser'@'localhost' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;
次のように、PHP 7.1といくつかのPHP 7.1拡張機能をインストールします。
sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
sudo yum install -y mod_php71w php71w-mysqlnd php71w-common
sudo yum install git -y
cd /var/www/html/
sudo git clone https://github.com/YOURLS/YOURLS.git
sudo chown -R apache:apache /var/www/html/YOURLS
cd YOURLS
sudo cp user/config-sample.php user/config.php
sudo chown apache:apache user/config.php
vi
テキストエディタを使用して/var/www/html/YOURLS/user/config.php
ファイルを開きます。
sudo vi user/config.php
以下の行を見つけます:
define( 'YOURLS_DB_USER', 'your db user name' );
define( 'YOURLS_DB_PASS', 'your db password' );
define( 'YOURLS_DB_NAME', 'yourls' );
define( 'YOURLS_SITE', 'http://your-own-domain-here.com' );
define( 'YOURLS_COOKIEKEY', 'modify this text with something random' );
$yourls_user_passwords = array(
'username' => 'password',
次のように、1つずつ交換します。
define( 'YOURLS_DB_USER', 'yourlsuser' );
define( 'YOURLS_DB_PASS', 'yourpassword' );
define( 'YOURLS_DB_NAME', 'yourls' );
define( 'YOURLS_SITE', 'http://example.com' );
define( 'YOURLS_COOKIEKEY', 'fmoi4jfsjfasfjlkfjalfgcggjkihdgfjjgdfolsfmwemlgjhgigjgitjaaewesfsdfsdogmbnsin' ); // Use a long string consists of random characters.
$yourls_user_passwords = array(
'username1' => 'password1', // Use your own username and password.
保存して終了:
:wq!
cat <<EOF | sudo tee -a /etc/httpd/conf.d/yourls.conf
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/YOURLS/
ServerName yourls.example.com
ServerAlias www.yourls.example.com
<Directory /var/www/html/YOURLS/>
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/httpd/yourls.example.com-error_log
CustomLog /var/log/httpd/yourls.example.com-access_log common
</VirtualHost>
EOF
sudo systemctl restart httpd.service
sudo firewall-cmd --zone=public --permanent --add-service=http
sudo firewall-cmd --reload
Webブラウザーでをポイントしhttp://example.com/admin
、Install YOURLS
リンクをクリックしてインストールを完了します。
YOURLSが正常にインストールされたら、YOURLS Administration Page
リンクをクリックしてYOURLS管理インターフェースにアクセスし、ユーザー名username1
とパスワードpassword1
を使用してログインします。
セキュリティ上の理由から、インストール後にYOURLSへのアクセス許可を制限する必要があります。
sudo chown -R root:root /var/www/html/YOURLS
プログラムをアップグレードするか、プラグインをインストールする必要がある場合は、次のようにその目的のための厳密なアクセス許可を元に戻すことができます。
sudo chown -R apache:apache /var/www/html/YOURLS
これでチュートリアルは終了です。読んでくれてありがとう。
CentOS 7サーバーにApache 2.4をインストールする方法を説明します。安定したウェブサーバーを構築するための前提条件と手順を解説します。
CentOS 7にSeafileサーバーをインストールする方法。Seafile(コミュニティバージョン)は、ownCloudに似た無料のオープンソースファイル同期および共有ソリューションです。
CentOS 7にGraylogサーバーをインストールし、ログ管理を行う方法を学びます。
CentOS 7サーバーにApache 2.4をインストールする方法を説明します。安定したウェブサーバーを構築するための前提条件と手順を解説します。
FreeBSD 11.1におけるBlacklistdのインストール方法について詳しく解説します。この方法を通じて、強力なセキュリティ対策を実装できます。
サーバーマネージャーを使用して、Windows Serverの管理が向上します。セキュリティリスクを軽減し、効率的な管理を実現します。
CentOS 7にSeafileサーバーをインストールする方法。Seafile(コミュニティバージョン)は、ownCloudに似た無料のオープンソースファイル同期および共有ソリューションです。
Snortは無料のネットワーク侵入検知システムです。最新の方法で、SnortをDebianにインストールし、設定する手順を紹介します。ネットワークのセキュリティを強化しましょう。
CentOS 7にGraylogサーバーをインストールし、ログ管理を行う方法を学びます。
WindowsサーバーでWebサイトを実行している場合、電子メールも受信できるようにするためにhMailServerを使用する方法を解説します。
FiveMサーバーをUbuntu 19.04にインストールするための詳細なガイド。必要条件からインストール、起動、トラブルシューティングまで、すべてのステップを含みます。
Debian 10にWebDAVをデプロイする方法を学び、WsgiDAVとSSL証明書で安全な接続を実現しましょう。
ヘルスケアにおけるAIは、過去数十年から大きな飛躍を遂げました。したがって、ヘルスケアにおけるAIの未来は、日々成長を続けています。