WordPress Docker代理错误502:代理服务器从上游服务器收到无效响应

时间:2017-02-02 11:32:28

标签: wordpress apache docker proxy

使用WordPress,我们在docker上放了一个项目。

我遇到了502代理错误。我能够修复它重启docker。但是,问题仍然存在于同事的安装上。

enter image description here

我试着解决它。但是,我无法重新创建该错误,因此我没有记录此错误。

这是dockerfile:



FROM debian:8

MAINTAINER xxxxxxxxxxxxx

LABEL version="1.0"
LABEL description="Debian 8 / Apache 2 / PHP 5"

ARG DEBIAN_FRONTEND=noninteractive

ENV DOCKER_CONTAINER_APP=/var/www

RUN apt-get -y update && apt-get install -y \
apache2 \
php5 \
libapache2-mod-php5 \
mysql-server \
php5-mysql \
supervisor \
phpmyadmin

RUN sed -i -e"s/^bind-address\s*=\s*127.0.0.1/bind-address = 0.0.0.0/" /etc/mysql/my.cnf

RUN /usr/sbin/mysqld & \

    sleep 10s &&\

    echo "GRANT ALL ON *.* TO admin@'%' IDENTIFIED BY 'heliopsis' WITH GRANT OPTION; FLUSH PRIVILEGES" | mysql

EXPOSE 3306

CMD ["/usr/bin/mysqld_safe"]

COPY ressources/supervisord.conf /etc/supervisor/conf.d/supervisord.conf

COPY ressources/my.cnf /etc/mysql/my.cnf

COPY ressources/init.sql /tmp/init.sql
RUN /etc/init.d/mysql start && mysql -uroot < /tmp/init.sql && /etc/init.d/mysql stop

COPY sql-dumps /tmp/sql-dumps
RUN  /etc/init.d/mysql start && gunzip < /tmp/sql-dumps/dump.sql.gz | mysql -uroot -D nalian-local && /etc/init.d/mysql stop

RUN /etc/init.d/mysql start && mysql -uroot -e "SET PASSWORD = PASSWORD('heliopsis');" && /etc/init.d/mysql stop

# Dev env : show errors
RUN sed -i -e 's/^error_reporting\s*=.*/error_reporting = E_ALL/' /etc/php5/apache2/php.ini
RUN sed -i -e 's/^display_errors\s*=.*/display_errors = On/' /etc/php5/apache2/php.ini
RUN a2enmod rewrite

RUN mkdir /etc/apache2/ssl
COPY ressources/vhost /etc/apache2/sites-available/000-default.conf

RUN a2ensite 000-default

# add our local files in docker instance
ADD . $DOCKER_CONTAINER_APP

# add the docker instance as a volume
VOLUME $DOCKER_CONTAINER_APP

# define the workspace of the container
WORKDIR $DOCKER_CONTAINER_APP

# launching apache @ startup
CMD cd wp-content; tar xzf $DOCKER_CONTAINER_APP/ressources/uploads.tar.gz; cd ..; ln -s wp-config-dev.php wp-config.php; ln -s htaccess_dev .htaccess;/usr/bin/supervisord
&#13;
&#13;
&#13;

install-vhost.sh:

&#13;
&#13;
#!/usr/bin/env bash

if [ -z "$1" ]
    then
        echo "dev name required"
        exit
fi

if [ -z "$2" ]
    then
        echo "HTTP port required"
        exit
fi

VHOST_TEMPLATE=`find . -name "*.DEV.rocks.conf"`
VHOST=`echo $VHOST_TEMPLATE | sed 's/.*\///' | sed "s/DEV/$1/"`

sudo cat $VHOST_TEMPLATE | replace "DEV" "$1" | replace "PORT" "$2" > /etc/apache2/sites-available/$VHOST

sudo a2ensite $VHOST

sudo service apache2 restart
&#13;
&#13;
&#13;

vhost:

&#13;
&#13;
############## www.nalian.coralie.rocks
<VirtualHost *:80>
    ServerName www.nalian.coralie.rocks
    <Proxy *>
        Allow from localhost
    </Proxy>
    ProxyPass / http://localhost:1250/
    ProxyPassReverse / http://localhost:1250/
    ProxyPreserveHost On
</VirtualHost>
&#13;
&#13;
&#13;

你有什么想法帮助我吗?

0 个答案:

没有答案