Table of Contents
How to configure LAMP server on a Linux Server (even for nibbleblog)
Errors covered:
- LAMP configuration
- Website directory setting
- Configuration changes
- File permission errors like nibbleblog error “The requested URL XYZ was not found on this server.” OR
I’m describing here the steps which I followed to configure my OVH server. The material was for a different server, however, it is common to all.
1. You have to subscribe to a linux server.
My choice is the OVH VPS SSD for below $4.
2. Choose Linux Flavor.
Choose any Linux flavor while purchasing as LAMP is not listing in that window. The LAMP server can be reinstalled later using the button.
3. Wait for the configuration email to reach your inbox.
It might take a while for the server to reflect in your OVH web control panel.
4. Reinstall LAMP server.
Once the configuration shows up, you have to click on the advanced button to the right and then click on the reinstall VPS option.
5. Configure WINSCP.
Once you reinstall the LAMP server, you will get a second email with the new username and password for the lamp server. Using the root username and password as mentioned in the email, enter the details in the configuration window.
6. Using SSH.
Once this is done, we have to download the portable version of Putty and enter the path of the .exe file in WinSCP to use SSH for configuration.
The path of the putty .exe file should be entered in Options >> Preferences >> Integration >> Applications and browse for the putty .exe file and save the changes.
Now, press and hold CTRL and P together to open the SSH window.
7. Execute the below commands in order as listed by replacing yourdomain.com with your domain name:
You may copy and use right-click to paste the commands into the terminal window.
mkdir -p /var/www/ganvwale.com/htdocs/
chown -R $USER:$USER /var/www/ganvwale.com/htdocs/
chmod -R 755 /var/www
nano /var/www/ganvwale.com/public_html/index.html
Now, please make sure the yourdomainname.com is replaced with your domain name or it will give an error.
Copy the below and paste it into the terminal:
<html>
<head>
<title>Success – Congratulation</title>
</head>
<body>
<h1>Success: You Have Set Up a Virtual Host</h1>
<p>Apache is running and setup fine</p>
</body>
</html>
Then, press CTRL + X.
Now, press letter Y and then hit Enter key.
After that, you should be back on the SSH terminal again.
Now, go to the location below using the WinSCP graphical interface:
/etc/apache2/sites-available/
Check the file with default or .conf file which has no SSL in the name and append the file name to the path below:
/etc/apache2/sites-available/
It should look like
/etc/apache2/sites-available/default.conf
depending on your file name.
Now, type the command by replacing your filename in the below command.
cp /etc/apache2/sites-available/default.conf /etc/apache2/sites-available/yourdomainname.com
Then, make a copy of default.conf and rename with your domain name
Execute the command below:
nano /etc/apache2/sites-available/yourdomainname.com
add the below lines to the file:
ServerName yourdomainname.com
ServerAlias www.yourdomainname.com
DocumentRoot /var/www/yourdomainname.com/htdocs/
Then, press CTRL and X buttons together.
Then press Y and Enter key.
Then execute the command:
a2ensite yourdomainname.com
now, execute the command
service apache2 restart
service apache2 reload
Check if the website is up and running.
if not, check the yourdomainname.com file using graphical interface editor and keep only the below lines:
<VirtualHost *:80>
ServerAdmin your email
ServerName yourdomainname.com
ServerAlias www.otherdomain.com
DocumentRoot /var/www/yourdomainname.com/htdocs
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
If there are any issues, there would be some unwanted lines or some configuration or permission issues in the directories and files.
Let’s check a file more. Go to the path below:
/etc/apache2
edit the file apache2.conf using graphical editor.
check for the lines with /var/www/ and replace the “AllowOverride None” with “AllowOverride ALL” and “Require all denied” with “Required all granted” as below and save the files:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Install postfix by running the command below:
apt-get install postfix
Then Enter to select OK
Then select Internet Site by hitting Enter key
Leave the server name as such.
Then, enter the command
/etc/init.d/postfix restart
If the issue is still not fixed, I suggest you not to experiment but contact me personally and I will fix it for you for a charge lower than others.
If there are any permission errors, make sure the file displayed has full access and change it accordingly if the issue is fixed with full access. This applies especially to Nibbleblog.
Repeat the domain-specific commands to add more domains.
Please do not forget to share this blog and rate it. We need your word of mouth and online promotion to get helping content going.
Comments
comments