Previous class
Secure the Magento Filesystem

Apache Configuration

You can change the permissions of this directory to allow your user to access it using the chmod command. This command changes the permissions of a file or directory. For example, to give all users read, write, and execute permissions on the public_html directory, you can use the following command:

bash
sudo chmod -R 777 /var/www/public_html

However, please note that this gives all users full permissions to the directory, which could pose a security risk. It's usually better to only give the necessary permissions to the specific users who need them.

As for making your Magento site public, you'll need to configure your web server (such as Apache or Nginx) to serve your Magento site from the public_html directory. This typically involves creating a new server block or virtual host configuration file that points to the public_html directory.

Here's an example of what this might look like for Apache:

bash
sudo nano /etc/apache2/sites-available/magento.conf

Then add the following configuration, replacing yourdomain.com with your actual domain:

apache
<VirtualHost *:80> ServerAdmin admin@yourdomain.com DocumentRoot /var/www/public_html ServerName yourdomain.com ServerAlias www.yourdomain.com <Directory /var/www/public_html/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>

Save and close the file, then enable the new site:

bash
sudo a2ensite magento.conf

Finally, restart Apache for the changes to take effect:

bash
sudo systemctl restart apache2

Please adjust the instructions according to your web server and setup. If you're using a different web server (like Nginx), or if you encounter any issues with these steps, please let me know.

We need to get the Apache server listening on port 80 correctly. 

The sites-available directory contains a magento.conf file, which should be the Apache configuration for your Magento site. Let's verify that it is set up correctly. Specifically, we want to check that the DocumentRoot and the <Directory> directives are correctly set to point to your Magento installation directory (/var/www/public_html).

You can view the contents of the magento.conf file using the cat command:

bash
cat /etc/apache2/sites-available/magento.conf

Look for the DocumentRoot directive and the <Directory> block. Here is an example of what you should be looking for:

apache
DocumentRoot /var/www/public_html <Directory /var/www/public_html/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory>

If these directives are not set correctly, you will need to edit the magento.conf file to correct them. You can use a text editor like nano or vi to edit this file. For example:

bash
sudo nano /etc/apache2/sites-available/magento.conf

After making any changes, be sure to restart Apache for the changes to take effect:

bash
sudo systemctl restart apache2

If everything seems to be configured correctly but you're still having issues, it may be helpful to check the Apache error log (/var/log/apache2/error.log) for any recent error messages.

Check if the web server is running: You can do this by using the following command:

For Apache:

bash
sudo systemctl status apache2

Test that the Magento website is running

 

  • Mark as Completed
  • More
Next class
Set Up Git Repo
Comments (0)
Login or Join to comment.

IMREAL.LIFE

Close