Web page 404 error on LAMP stack on Ubuntu 18.04 GitHub-hosted Runner for GitHub Actions

156 Views Asked by At

For some reason, I can access the homepage of my site (there's an index.php) but every other page gives a 404 error. The PHP framework used is Joomla CMS. I have in my .htaccess file the following line AddHandler application/x-httpd-php7 .php. Everything is via HTTPS. I tried to access via curl and Python Selenium. Both give the same problem. Note that in my development environment (local Windows 10) and in production (Linux) I have no such problem.

For GitHub Actions workflow, I've setup MySQL using services property in YAML. I made PHP7.4 as the default with command sudo update-alternatives --set php /usr/bin/php7.4. For Apache, these is the step:

- name: Config and start Apache server
run: |
    sudo ufw disable
    sudo touch /etc/apache2/conf-available/ssl-params.conf
    sudo apt install libapache2-mod-php7.4
    sudo a2enmod php7.4 deflate expires filter headers rewrite ssl proxy proxy_http
    sudo a2enconf ssl-params
    sudo a2ensite default-ssl
    sudo systemctl restart apache2
    sudo ln -s /home/runner/work/web/web /var/www/html/mysite

Full versions are as follows:

Current dir: /home/runner/work/web/web
----------------------------------------------------------
Linux fv-az297-679 5.4.0-1072-azure #75~18.04.1-Ubuntu SMP Wed Mar 2 14:41:08 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.6 LTS
Release:    18.04
Codename:   bionic
----------------------------------------------------------
Server version: Apache/2.4.29 (Ubuntu)
Server built:   2022-01-05T14:50:41
----------------------------------------------------------
mysql  Ver 14.14 Distrib 5.7.37, for Linux (x86_64) using  EditLine wrapper
----------------------------------------------------------
update-alternatives: using /usr/bin/php7.4 to provide /usr/bin/php (php) in manual mode
PHP 7.4.28 (cli) (built: Feb 17 2022 16:06:19) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.28, Copyright (c), by Zend Technologies
    with Xdebug v3.1.2, Copyright (c) 2002-2021, by Derick Rethans
1

There are 1 best solutions below

0
On

I got it working by updating Apache config with the following workflow step: sudo perl -i -p -e "s/AllowOverride None/AllowOverride All/g" /etc/apache2/apache2.conf