Vue.JS and Laravel work, you can look at port 8000, but it doesn’t simplify things. If we want our app to be available traditionally, we need to set up a few things.
Let’s start by setting up PHP-FPM. Its default user is www-data. We, on the other hand, have to run it with our own user, which we specified when installing the distribution. You will need to do the same with Apache.
~$ sudo nano /etc/php/8.x/fpm/pool.d/www.conf // where 8.x equals our PP-FPM version.
user = username
group = username
...
listen.owner = username
listen.group = username
~$ sudo nano /etc/apache2/envvars
The next two lines must be rewritten:
export APACHE_RUN_USER=username
export APACHE_RUN_GROUP=username
Then restart the PHP-FPM and the Apache2 services
~$ sudo systemctl restart php8.x-fpm && sudo systemctl restart apache2
Now let’s rewrite the default Apache virtual host configuration file.
~$ sudo nano /etc/apache2/sites-available/000-default.conf
Delete its contents and rewrite it with the following
<VirtualHost *:80>
ServerAdmin admin@example.com
ServerName mydomain.com
DocumentRoot /home/username/example-app/public
<Directory /home/username/example-app/>
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Almost done.