I have a site up and running on Ubuntu 14. I have recently set up a new server with the same provider to migrate to Ununtu 16, and that is up and running. At the same time, I am trying out Digital Ocean with Ubuntu 18. This requires a lot of manual installation of the webserver, php, msqyl, etc., which is new to me as I’m used to doing everything through Plesk.
I’ve been able install and configure everything with no obvious problems. I can access the frontend/web/index.php and everything looks fine. I can even get Yii formatted errors.
However, if I click on any link, I get what appears to be an Apache error, NOT FOUND. This goes for static or dynamic pages. Also, I don’t have access to gii or the debug toolbar, even though I’ve enabled those in the configs.
When I run requirements.php, it appears that everything I need is installed.
What could possibly be going wrong here? I’m suspecting my Apache setup, but what could it be?
I’ve been able install and configure everything with no obvious problems. I can access the frontend/web/index.php and everything looks fine. I can even get Yii formatted errors.
What do the URL look like here?
However, if I click on any link, I get what appears to be an Apache error, NOT FOUND
And what’s the URL here?
Comparing both working and non working cases will help you find the solution.
Could you tell us more about your apache setup ? What does your vhost look like ?
The homepage is example.com.
Any other url I try, such as example.com/terms or example.com/site/settings gives the error. The url rules work fine on two other servers. I don’t think the url rules are even being applied in this case.
That’s a great idea. Actually I’m having a hard time finding my virtual host configuration at the command line on the other servers as those were created through plesk. The etc/apache2/sites-available doesn’t list my other domains, so I’m not sure where they’ve stashed that.
Indeed, you seem to have misconfigured the rewrite rules.
Try this:
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
Yes, example.com-le-ssl.conf is indeed your https vhost, but it’s missing the apache Rewrite rules.
So when you access example.com/, apache looks for index.html,index.php,… inside your document root. It finds Yii index.php and is able to show the home page.
But for example.com/foobar, it looks for the /var/www/example.com/html/frontend/web/foobar/ directory and doesn’t find it. That’s what the 4 lines starting at RewriteEngine on are all about, they tell Apache: If you don’t find the requested file, or folder, then uses frontend/web/index.php