1

我想在CircleCI上设置Processwire CMS ,并且在使用 Apache Webserver 时遇到了一些问题。

在我对 CasperJS 的测试中,我总是得到错误:

<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN"><html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access /
on this server.</p>
<hr>
<address>Apache/2.4.7 (Ubuntu) Server at contenthub.dev Port 8080</address>

</body></html>

我的 Apache 配置是:

Listen 8080

<VirtualHost *:8080>
  LoadModule php7_module /opt/circleci/php/7.0.17/usr/lib/apache2/modules/libphp7.so

  DocumentRoot /home/ubuntu/content-hub-test
  ServerName contenthub.dev
  DirectoryIndex index.html index.json index.php
  LogLevel notice

  <FilesMatch \.php$>
    SetHandler application/x-httpd-php
  </FilesMatch>

  <Directory /home/ubuntu/content-hub-test>
    AllowOverride All
    Allow from All
  </Directory>

</VirtualHost>

我的 circle.yml 是:

machine:
  timezone:
    Europe/Vienna
  ruby:
    version: ruby-2.2.6
  node:
    version: 8.0.0
  php:
    version: 7.0.17
  python:
    version: 3.6.1
  hosts:
    contenthub.dev: 127.0.0.1

dependencies:
  pre:
    - npm install
    - npm install -g casperjs
    - gem install compass
  post:
    - sudo rm /etc/apache2/mods-enabled/php5.load #damit php 7 geht
    - sudo cp ~/content-hub-test/apache_ci.conf /etc/apache2/sites-available
    - sudo a2ensite apache_ci.conf
    - sudo service apache2 restart

checkout:
  post:
    - sudo mv ~/content-hub-test/site/config-circleci.php ~/content-hub-test/site/config.php

database:
  override:
    - mysql -u ubuntu circle_test < ~/content-hub-test/processwire_ci_db.sql

compile:
  override:
    - ~/content-hub-test/node_modules/gulp/bin/gulp.js --gulpfile ~/content-hub-test/Gulpfile.js --cwd ~/content-hub-test --testing

test:
  override:
    - casperjs ~/content-hub-test/tests/test.js

general:
  artifacts:
    - "/var/log/apache2/"

circleci 文档也推荐此设置。我所有的 PHP 文件都在 ~/content-hub-test 文件夹中。我想我在 apache 配置中做错了什么 - 但是呢?

4

1 回答 1

1

我找到了这个解决方案并且它有效:

Listen 8080

<VirtualHost *:8080>
  LoadModule php7_module /opt/circleci/php/7.0.17/usr/lib/apache2/modules/libphp7.so

  DocumentRoot /home/ubuntu/content-hub-test
  ServerName contenthub.dev
  DirectoryIndex index.html index.json index.php
  LogLevel notice

  <FilesMatch \.php$>
    SetHandler application/x-httpd-php
  </FilesMatch>

  <Directory /home/ubuntu/content-hub-test>
    AllowOverride All
    Allow from All
    Require all granted
  </Directory>

</VirtualHost>
于 2017-06-01T13:00:35.990 回答