Deploying yii2 application

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?

Submit an answer

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!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @solutionbasecorp,

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
    DocumentRoot /var/www/html/myfolder
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

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