I was deploying a web application using the yii2 framework, it was working fine on my previous dev machine, I’m using xampp as my webserver. I already copied the application on default directory /var/www/html/myfolder. But I got an error 404 Not Found (The requested URL was not found on this server). I’m using Apache/2.4.29. Is there anything I need to setup or reconfigure? Do I need to install yii framework too?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
When using Apache, you need to configure your domain in a virtualconfig file so that Apache knows from where to load the files.
Since you are using ubuntu, go to folder
cd /etc/apache2/sites-available
Inside create he configuration file like so
touch DomainName.conf
where DomainName, is your actual domain name. The most basic configuration file looks like so
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/html/myfolder
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Again, remember to put our own DocumentRoot folder and in the ServerName and SeverAlias spaces to put your actual domain name.
Now to enable the file you need to run
sudo a2ensite DomainName.conf
sudo systemctl restart apache2
sudo systemctl status apache2
That’s it, you should now have a working website.
Regards, KFSys
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.