このエラーを解決するには:HTTP ERROR 500およびchcon:WordPressでタグ付けされていないファイルに部分コンテキストを適用できません。

このエラーを解決するには:HTTP ERROR 500およびchcon:WordPressでタグ付けされていないファイルに部分コンテキストを適用できません。

このコードを修正しようとしてエラーが発生し、コードは実行されません。また、パブリックIPを使用してWordPressを実行したいと思います。

問題は、「chcon:タグ付けされていない部分コンテキストを適用できません」というエラーが発生するため、sudo chcon -t httpd_sys_rw_content_t /var/www/html/ -Rを実行できないことです。

2番目の問題は、認定IPを使用するとhttp://xxxx/ WordPressブラウザのWordPressインスタンスに対してHTTPエラー500が発生します。私のWordPressファイルは/var/www/htmlディレクトリにあり、Apacheが実行されています。

間違い:

aws_instance.wp (remote-exec): Failed to restart service\x0d.service: Unit not found.
aws_instance.wp (remote-exec): --2020-08-19 13:04:52--  https://wordpress.org/latest.tar.gz%0D
aws_instance.wp (remote-exec): Resolving wordpress.org (wordpress.org)... 198.143.164.252
aws_instance.wp (remote-exec): Connecting to wordpress.org (wordpress.org)|198.143.164.252|:443... connected.
aws_instance.wp (remote-exec): HTTP request sent, awaiting response... 400 Bad Request
aws_instance.wp (remote-exec): 2020-08-19 13:04:52 ERROR 400: Bad Request.

aws_instance.wp (remote-exec): tar: latest.tar.gz\r: Cannot open: No such file or directory
aws_instance.wp (remote-exec): tar: Error is not recoverable: exiting now
aws_instance.wp (remote-exec): mv: cannot stat ‘wordpress/*’: No such file or directory
aws_instance.wp (remote-exec): chown: cannot access ‘/var/www/html/\r’: No such file or directory
aws_instance.wp (remote-exec): chcon: invalid option -- '
aws_instance.wp (remote-exec): '
aws_instance.wp (remote-exec): Try 'chcon --help' for more information.
aws_instance.wp (remote-exec): sed: can't read /etc/selinux/config
aws_instance.wp (remote-exec): : No such file or directory
aws_instance.wp (remote-exec): setenforce: SELinux is disabled
aws_instance.wp: Creation complete after 58s [id=i-0068d9c9935666018]

次のコードを使用しています。

#!/bin/bash#Update yum
sudo yum -y update
sudo yum -y install httpd
sudo systemctl enable httpd service
sudo systemctl start httpd service
sudo yum install wget -y
sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo yum-config-manager --disable remi-php54
sudo yum-config-manager --enable remi-php56
sudo yum install -y php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo
sudo systemctl restart httpd service
sudo wget https://wordpress.org/latest.tar.gz
sudo tar -xvf latest.tar.gz
sudo rm -rf latest.tar.gz
sudo rm -rf /var/www/html/*
sudo mv wordpress/* /var/www/html/
sudo rm -rf wordpress
sudo chown -R apache:apache /var/www/html/
sudo chcon -t httpd_sys_rw_content_t /var/www/html/ -R
sudo sed -i s/^SELINUX=.*$/SELINUX=permissive/ /etc/selinux/config
sudo setenforce 0
sudo systemctl restart httpd.service

ベストアンサー1

おすすめ記事