1

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.

6
  • Please, make sure that Store >> Configuration >> Advanced >> Developer >> Static Files Settings >> Sign Static Files is setted "No" if not then set it to "No" prnt.sc/j44ur2 Commented Apr 12, 2018 at 6:09
  • @PGSutariya: Yes I have already set this to 0 in database. Commented Apr 12, 2018 at 6:37
  • after fresh installation do you face same issue ? or issue persists ? Commented Apr 12, 2018 at 6:57
  • @Naveed: There are no issues in fresh magento installations. Commented Apr 12, 2018 at 7:28
  • @WasiqShahrukh i believe when you say there is no issue it means you have explored all pages ( i.e category, product, checkout etc ) pages also development mode on both evnoirnments is same ? Commented Apr 12, 2018 at 7:39

1 Answer 1

2

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.

2
  • It was ownership issue, I have given ownership to www-data user. Now it is working fine. Commented Apr 13, 2018 at 7:53
  • great, glad your issue solved Commented Apr 13, 2018 at 8:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.