Hi @pathakkrunal,
I was able to change Magento root path to /pub following these steps:
1. Edit Apache configuration
Edit the following files changing /opt/bitnami/apps/magento/htdocs
by /opt/bitnami/apps/magento/htdocs/pub
:
- /opt/bitnami/apps/magento/conf/httpd-prefix.conf
- /opt/bitnami/apps/magento/conf/httpd-app.conf
2. Edit Varnish configuration
Change all the occurrences of "/pub/health_check.php"
by "/health_check.php"
in the following file:
- /opt/bitnami/varnish/etc/varnish/magento.vcl
3. Update secure and unsecure URL paths in database
Connect to the MySQL server and run the following commands:
mysql> use bitnami_magento
mysql> UPDATE core_config_data SET value='{{unsecure_base_url}}static/' WHERE path='web/unsecure/base_static_url';
mysql> UPDATE core_config_data SET value='{{secure_base_url}}static/' WHERE path='web/secure/base_static_url';
mysql> UPDATE core_config_data SET value='{{unsecure_base_url}}media/' WHERE path='web/unsecure/base_media_url';
mysql> UPDATE core_config_data SET value='{{secure_base_url}}media/' WHERE path='web/secure/base_media_url';
mysql> exit
4. Switch Magento modes
Load the Bitnami environment:
sudo /opt/bitnami/use_magento
Execute the following commands to configure Magento modes:
cd /opt/bitnami/apps/magento/htdocs
./bin/magento-cli deploy:mode:set developer
./bin/magento-cli cache:flush
./bin/magento-cli deploy:mode:set production
./bin/magento-cli cache:flush
5. Deploy static content
Finally, deploy the static content:
./bin/magento-cli setup:static-content:deploy
6. Restart Varnish and Apache servers
sudo /opt/bitnami/ctlscript.sh restart varnish
sudo /opt/bitnami/ctlscript.sh restart apache
I hope it helps,
Tomas