Depending on your server configuration and running webusers you need to setup write access to some directories. All other files should be read only to the webuser! This will make sure your website isn't defaced easily.
First of all, there are a lot of reasons to not have a /downloader
directory on production environments. There have been some patches in the past for the downloader. Add some sort of security with basic auth on these directories
First of all, reset all to read only/default.
# In your Magento root directory
# This will put all files in readonly for group/other and write for user
chmod ugo-rwx,ugo+rX,u+w -R .
# Some files need execute rights
chmod +x cron.sh mage
# Some directories need write access
chmod go+w -R media var downloader includes
Also remove downloader/connect.cfg
so it will re-initiate.
[Wed May 17 15:49:56.848543 2017] [core:alert] [pid 981] [client 208.74.121.106:23024] /home/aemadminuser/public_html/.htaccess: Invalid command 'SetEnv', perhaps misspelled or defined by a module not included in the server configuration
[Wed May 17 15:49:56.849866 2017] [core:alert] [pid 981] [client 208.74.121.106:23024] /home/aemadminuser/public_html/.htaccess: Invalid command 'SetEnv', perhaps misspelled or defined by a module not included in the server configuration
[Wed May 17 15:49:57.067999 2017] [core:alert] [pid 3839] [client 208.74.121.106:23074] /home/aemadminuser/public_html/.htaccess: Invalid command 'SetEnv', perhaps misspelled or defined by a module not included in the server configuration, referer: http://magento.*********.com/index.php
[Wed May 17 15:49:57.069328 2017] [core:alert] [pid 3839] [client 208.74.121.106:23074] /home/aemadminuser/public_html/.htaccess: Invalid command 'SetEnv', perhaps misspelled or defined by a module not included in the server configuration, referer: http://magento.*********.com/index.php
This appears to be due to the following line within your .htaccess:
[15:50:19 aem root@8483997 /home/aemadminuser/public_html]cPs# grep SetEnv /home/aemadminuser/public_html/.htaccess
SetEnv MAGE_IS_DEVELOPER_MODE "true"
This is due to mod_env not being installed on the server. You can install this Apache module via WHM by navigating to EasyApache 4 under the Apache Modules. If you would like I would be more than happy to assist with enabling this module however you will need to ensure that our IP addresses are able to successfully access WHM. I have included these IP addresses for you below:
Couldn't access - bug with apacheeasy4
via the command line:
Installing:
ea-apache24-mod_env | x86_64
2.4.25-9.9.2.cpanel | EA4 27k
Upon completion I no longer received any errors within the Apache error_log however there was still an HTTP 500 error being generated by the Magento script. This contained the following error:
[17-May-2017 23:37:59 UTC] PHP Fatal error: Uncaught exception 'Zend\Stdlib\Exception\RuntimeException' with message 'No wrapper found supporting "UTF-8"' in /home/aemadminuser/public_html/vendor/zendframework/zend-stdlib/src/StringUtils.php:135
With a bit of research, I was able to determine that this was due missing the mbstring PHP extension. I went ahead and installed this and now both the URLs are loading without any errors:
Installing:
ea-php56-php-mbstring | x86_64
5.6.30-12.12.1.cpanel | EA4 523 k
my site now loads.
Best Answer
For 500 error, you need to enable mod_version in apache.
You can check all the enabled apache modules with the command
apache2ctl -M
. If you don't see it in the list, then it's not installed.To do this run the command
a2enmod version
as the root user, orsudo a2enmod version
as a non-root user and then reload apache withapache2ctl reload
.For 404 error regarding css and js, you can try changing:
to
in the
.htaccess
file located in the following locations:/www/
or/public_html/
folder)/pub/
/pub/static/
/pub/media/