Question

I am working on magento 2.1.10

It is working fine on local server, each time I make any changes in CSS or add any custom modules the changes are online on frontend after I upgrade, content deploy and flush cache from terminal.

But I am trying to move this installation to other servers. Compressed the whole project and extracted on target server and also added database with all suitable changes, made changes in env.php for database connectivity.

Following things I have tried:

Remove cache and static content.

Now, when I run these commands for upgrade, content deploy and flush cache there is still no css or js loading on frontend.

I have also changed ownership of magento's root dir on server to the user from which I am logged in in CLI, added this user to appache's user group, again ran these commands in terminal still facing the same issues.

Is there anything that I am missing here?

I have tried to move it on 2 different servers but still CSS and JS are not loading.

Note: If I am installing a fresh magento on these servers then there are no issues on both these servers.

Was it helpful?

Solution

After migration to other server there are few steps to get site running and working ( standard way ):

Step 1 - Change db credentials in env.php

Step 2 - Login to Mysql and go core_config_data :

and change web/unsecure/base_url and web/secure/base_url values.

Step 3 - Delete var/cache, pub/static/frontend, pub/static/adminhtml, var/view_processed and generated folder using following command:

rm -rf generated pub/static/frontend pub/static/adminhtml var/view_preprocessed var/cache

Step 4 - Then run updrage, compilation and static content deploy :

php bin/magento setup:upgrade

php bin/magento setup:di:compile

php bin/magento setup:static-content:deploy -f

Step 5 - : Configure cron jobs to send out transnational emails.

If all above completed and still facing issue :

there could be any or all of below issues

a ) Change Files / Folder permission ownership chown -R www-data:www-data ./magento-folder

b) if having url-redaction issue or js/css not loading : disable static-version settings in magento admin (if it works ) then most likely it will be due to your server config :

go to :

/etc/apache2/sites-available/default

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

I believe you have all above 5 steps and still having issue then try with ownership / permission command mentioned in (a) hope it will solve the issue.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top