カスタムHTTPリポジトリがローカルCentosサーバーに表示されることを拒否します。

カスタムHTTPリポジトリがローカルCentosサーバーに表示されることを拒否します。

CentosインストールDVD isoからコピーしたローカルパッケージストアを設定しました。

ローカルDNSアドレス(myrpmweb)とコンピュータのLAN IPがApache 123を正常にロードします。 Firefoxブラウザでテストページを読み込んでいますが、[自分のローカルLAN IP] / rpmを読み込もうとすると、「見つかりません、要求されたURL / rpm」と表示されます。このサーバーが見つかりません。

説明した手順を使用しました。ここ(リンク)、私のローカルHTTPリポジトリを設定しようとしています。

引き続きカスタムリポジトリの構成情報を表示します。

/etc/yum.repos.d/kix.repo ファイルの内容

name=kix repo
baseurl=file:///home/kix/rpm
enabled=1
gpgcheck=0

createrepoを実行した後、ディレクトリに「repodata」というフォルダがあり、その上にロックアイコンがあります。

/home/kix/rpm/

チュートリアルの指示に従ってフォルダの正しい所有権を設定しました。

chmod -R o-w+r /home/kix/rpm/repo

centos DVD isoのパッケージを/home/kix//rpm/centos/ディレクトリに転送した後、パッケージをロードできます。現在の作業ディレクトリ(PWD)もそのディレクトリに設定されます。

[root@myserver centos]# yum install jaxen-1.1.3-11.el7.noarch.rpm
Loaded plugins: fastestmirror, langpacks
Examining jaxen-1.1.3-11.el7.noarch.rpm: jaxen-1.1.3-11.el7.noarch
jaxen-1.1.3-11.el7.noarch.rpm: does not update installed package.
Error: Nothing to do

パッケージが送信される場所へのシンボリックリンクを作成しました。

 ln -s /var/www/html/repo /home/kix/rpm

/var/ww/html/repoのrepoディレクトリをクリックするとcentosフォルダが表示され、centosフォルダをクリックすると/home/kix/rpm/repo/centosに表示されるパッケージが表示されます。

ls –laも次のことを確認しました。合計276個

drwxr-xr-x. 3 root root     20 Sep  9 19:59 .
drwxr-xr-x. 5 root root     50 Sep  8 12:30 ..
drwxr-xr-x. 4 kix  kix  221184 Sep  8 12:03 centos

次のいずれもFirefoxからリポジトリをロードせず、myrpmwebも私のIPアドレスに置き換えました。

http://myrpmweb/rpm
http://myrpmweb/repo
http://myrpmweb/centos

setenforce が 0 に設定されました。

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=permissive
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

apachectl configtest コマンドは以下を表示します。

AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/httpd/conf.d/vhost.conf:1
Syntax OK

/etc/httpd/conf.d/vhost.conf、表示

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName server.home
    ServerAlias www.example.com
    DocumentRoot /var/www/html/example.com/public_html/
    ErrorLog /var/www/html/example.com/logs/error.log
    CustomLog /var/www/html/example.com/logs/access.log combined
</VirtualHost>

この問題を解決するための次のステップは何ですか?

ベストアンサー1

以下のリンクに掲載されているソリューションは問題を解決します。
https://stackoverflow.com/questions/41917171/apache2-404-error-for-index-html/41917743#41917743

ディレクトリブロックは/etc/httpd/conf.d/vhost.confファイルで定義する必要があります。

NameVirtualHost *:80

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName server.home
    ServerAlias www.example.com
    DocumentRoot /var/www/html
    ErrorLog /var/log/httpd/error.log
    CustomLog /var/log/httpd/access.log combined
    <Directory "/var/www/html">             # quoted
        AllowOverride All
        Require all granted                 # required in Apache 2.4
    </Directory>
</VirtualHost>

おすすめ記事