Configuring apache2,mysql and Php on my ubuntu

How do I configure apache2 web server on my Ubuntu,so that I can run my html scripts?

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.

In case you’re going with a manual LAMP install: [Link]

Then I advise to secure your server by enabling the firewall and installing Fail2Ban. It’s not a bad idea to change the default SSH port to something else, because you’ll already see a lot of brute force attempts few hours after setting up the droplet.

Additional steps: [Link] Fail2Ban: [Link]

If you don’t intend to fiddle with your droplet after setting it up it’s also a nice idea to enable automatic security updates: [Link] (scroll to the bottom of the post)

P.s.: My only issue with Fail2Ban is that it stopped working after the logs rotated—happens every week by default, I think. I may have managed to fix it in my droplet, but I’m not entirely sure yet. Meanwhile keep an eye on your logs to make sure it works.

The best way is to create a digitalocean LAMP droplet, it has everything preconfigured. All you’d have to do, at a minimum, is drop your PHP scripts into /var/www and it should be able to serve those scripts. If you wanted to write to that folder using PHP (for example, file uploads or image manipulation), I’d create a subfolder under that and change the ownership to www-data.

If you have a droplet (or any linux machine) but don’t have apache, MySQL and php installed, it’s not too hard to install it. Here’s a tutorial that should give you the basics.