How to deploy Create React App to Hostinger? - hosting

Im having a problem viewing the subpages of my website that i deployed to Hostinger root folder or equivalent(subdomain), I run "npm run build" and deploy the files inside "build" folder to hostinger.
Of course it works on my local and firebase, but not on Hostinger.
See the files below for home, inner pages and FTP content.
home:
subpages:
ftp content from "build" folder.
Thanks!

I got this here are the steps:
Create .htaccess inside your 'public' folder and paste the ff code.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]
</IfModule>
Build the app using the command below.
npm run build OR yarn build
And deploy your 'build' folder to your root folder or equivalent(subdomains).
That's it, It works to me.

Related

404 on Laravel Elastic BeanStalk

I am trying to deploy a Laravel 7 application to Elastic BeanStalk but having some problem with the routing.
I have followed the tutorial from the video below and upload the zip archive with all my local files.
I have also fixed the permission issue after having set the root to /public.
Currently, the only page visible is the homepage whereas al the other pages like /login, /register and the other show me a 404
here is the log of the from eb:
2020/05/01 14:19:30 [error] 4091#0: *4 open() "/var/www/html/public/login" failed (2: No such file or directory), client: 82.4.194.3, server: , request: "GET /login HTTP/1.1"
https://www.youtube.com/watch?v=ISVaMijczKc
I suppose you are using Beanstalk PHP platform with Linux in version 2; this version uses Nginx (whereas the previous version uses Apache).
You can see more details in the official documentation: https://docs.aws.amazon.com/elasticbeanstalk/latest/platforms/platforms-supported.html#platforms-supported.PHP
In that case, you have to configure Nginx for redirection as described in the Laravel documentation: https://laravel.com/docs/7.x/deployment#nginx
Just create the file .platform/nginx/conf.d/elasticbeanstalk/laravel.conf (at the root of your project):
location / {
try_files $uri $uri/ /index.php?$query_string;
}
Feel free to add other configuration for your need.
You will find more details about extending the platform here: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/platforms-linux-extend.html
After several attempts, I have it up and running. I had deleted the application and used EB CLI to create it again.
I created an environment config and placed it in .ebextentions and I added AllowOverride All
Here is the content of my 01-environment.config
option_settings:
aws:elasticbeanstalk:container:php:phpini:
document_root: /public
composer_options: --no-dev
aws:elasticbeanstalk:application:environment:
APP_ENV: production
APP_KEY: base64:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
and my .htaccess file
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
AllowOverride All
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

Laravel Symbolic Link in Shared hosting problem

I am using shared hosting.
I have installed my laravel application and i am using unisharp Laravel File Manager.
With the manager, I uploaded file "happy.jpg". it produced url "http://unpluggedworldofmine.com/storage/photos/1/happy.jpg" but i cannot access to the file.
instead, when i use
"http://unpluggedworldofmine.com//storage/app/public/photos/1/happy.jpg", i can see that i has been uploaded properly.
it looks like there is problem with .htaccess
RewriteEngine on
RewriteRule ^/?$ /public/ [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(.*) /public/$1 [L]
AS i am using shared hosting, i cannot change configuration in httd or others.
i used
php artisan storage:link
to set up link.
can anyone help me with this?
Thanks

how to setup the .htaccess for a subdomain on a shared hosting godaddy server

I want to upload my local Laravel project on godaddy but I'm having some error
error
[Wed Jul 05 21:16:44.858396 2017]
[autoindex:error] [pid 21796:tid 139689709188864]
[client 99.240.235.234:57754]
AH01276:
Cannot serve directory /home/bugsbunny/public_html/sto.com/:
No matching DirectoryIndex (/home/bugsbunny/public_html/sto.com/public/index.php)
found, and server-generated directory index forbidden by Options directive
.htaccess
DirectoryIndex /home/bugsbunny/public_html/sto.com/public/index.php
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ /home/bugsbunny/public_html/sto.com/public/index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
steps that I did
I edited the public/.htaccess file
by edited I mean changing the directory on the first line and the line starting by RewriteRule
I cut & paste this file into the root directory
I uploaded the project into godaddy
On Godaddy I find it easier to create/upload a Laravel app with this procedure
1- Create an addon domain or a sub-domain on Godaddy
2- Install a Laravel app (Quick-install) on this domain/sub-domain
3- Download this app on local (my computer) with Filezilla (or other sftp software)
4- On local disk change the .env database access or (create a user+password+database on phpmyadmin/mysql with the information contain in the .env that Godaddy setup for you)
5- finish up the app (Build the webapp project that you want to do).
6- Upload the app to the server (except the .env) with Filezilla
7- upload the database (mysql) from local to Godaddy
So there is no need to change the .htaccess file.
Why you are not using dedicated hosting for laravel. Get your server and [digitaloccean, etc] and do what you want...

Server error VQMOD Opencart permissions: You don't have permission to access /shop/vqmod/install on this server

I have a website running with a content management system running in the root of my website. I have installed the latest version of Opencart in a sub-directory called "shop" - so www.domain.com/shop/
Everything works fine and I can use Opencart as expected.
I need to install VQmod so have uploaded the files to the root of the shop folder, I have set the correct permissions trying 755 and 777 but with no luck.
Every time I go to www.domain.com/shop/vqmod/install I get a 403 error.
Same with www.domain.com/shop/vqmod/
Forbidden
You don't have permission to access /shop/vqmod/install on this server.
Apache Server at domain.com Port 80
My .hta file is pretty much standard apart from taking out the index.php? out of the urls and a rewrite rule to say change the home link.
RewriteBase /shop/
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^download/(.*) /index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
RewriteCond %{QUERY_STRING} ^route=common/home$
RewriteCond %{REQUEST_METHOD} !^POST$
RewriteRule ^index\.php$ http://%{HTTP_HOST}? [R=301,L]
I am running on an apache server mentioned in error and on plesk control panel. I am stuck!
Also I have a .hta file in my very root where the cms files are how do I ensure that does not conflict the with opencart website.
found it at last....
.htaccess in of vqmod is set to Deny from all. change it to allow and it should work fine!
Did you also change the file permissions for your www.domain.com/shop/index.php and www.domain.com/shop/admin/index.php files during vqmod installation?
This is vital as changes are made to these files during the auto-installation process.

Magento Nginx: Never rewrite for existing files, directories and links

I install my Magento CE 1.8.1 on Nginx server.
My nginx conf file is like this: Configuring nginx for Magento
I created a subfolder in Magento root folder, then put in it some php files.
I tried to execute those files by visiting urls (http://example.com/magento/subfolder/myfile.php) but it displays Magento 404 page. That means it was forced to rewrite by conf.
I looked into Magento default .htaccess file and found these lines:
############################################
## never rewrite for existing files, directories and links
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
How to convert this into nginx conf and make existing files executable?

Resources