I corrected the file permissions using this command (find . -type d -exec chmod 770 {} ; && find . -type f -exec chmod 660 {} ; && chmod u+x bin/magento), and after that pub folder is showing when I visit my website. Please see the screenshot for a better understanding. enter image description here
4 Answers 4
I've checked your site, looks like remove some folders and files from the Magento codebase by accident. To revert those changes, run the following commands from your Magento root directory:
rm -rf vendor
composer install
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy -f
Please take a look at the document from Magento official to set files and folders permissions: https://experienceleague.adobe.com/docs/commerce-operations/configuration-guide/deployment/file-system-permissions.html
- 
 If this answer works as your expected, please mark it as accepted. That indicates your issue is solved and makes it easier for others with the same issue to find a verified answer.Tu Van– Tu Van2022年11月11日 13:34:13 +00:00Commented Nov 11, 2022 at 13:34
I checked the attached png file.
But it looks like the index.php file was missed.
So I think you have to download Magento again.
If there's a composer.json in your root directory, then run the composer install command.
If not, then install the magento following this doc.
https://experienceleague.adobe.com/docs/commerce-operations/installation-guide/composer.html 
You can try this:
rm -rf vendor
composer install
composer update
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy -f
You need to check the file permissions and reset it with login sudo root user to change the permissions.
run the following commands from your Magento root directory:
rm -rf generated/*
rm -rf var/*
cd pub/static
rm -r adminhtml
rm -r frontend
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f
php bin/magento indexer:reindex
php bin/magento cache:clean
php bin/magento cache:flush
It could fix the permission issue. If not to fix application issues such as: composer, you can then re-install magento with composer such as:
rm -rf vendor
composer install
Thanks