How to host a static web page on Heroku - heroku

I have created a simple one-page responsive design demo website that I want to test across all major devices. I want to change my website design on my local machine and then deploy it to Heroku so I can test my website on a public website across multiple devices.

Create new directory
Create index.html in new directory
Create index.php (Prompts Heroku to deploy index.html as a php app) using touch index.php
git init
git add index.php
git add index.html
git commit -m "Your comments..."
heroku create
git push heroku master
Open the url for your new Heroku app and view your static website on any device
To test new changes to your local website, repeat steps 6, 7, 9 and 10.
Advantages: 1) It takes less than a minute to deploy your site on the public web via Heroku; 2) It's free.

Related

one-click Strapi deployment but no empty .git folder localy

I have watched a demo video how to use one-click Strapi deployment to set up a Strapi API. I follow all the steps in the video and I get no messages until I get the message: "you appear to have cloned an empty repository". This also happens in the video, but the tutor has an empty .git folder in the project folder. He says it is important that this is there but for me there is no .git folder. I am very confused since I do the exact same steps. Anyone had this issue? I can run the Strapi API locally on my machine, but I want to create a page with Netlify that fetches data from the said API and display it on the web for my portfolio. I am right that if I do this locally and not via Heroku I can't display products etc. for a final website?

Run an app from a subfolder in the public folder of a Laravel app

I need to install a custom app in a subfolder of my site, and make that publicly accessible. Like mysite.com/results, where inside the results folder will be a custom JS app responsible for displaying results of some running / cycling events.
Update
By custom JS app I mean a bunch of files that comes from the race timing software I use, so I have no control of the files there, just need to be able to make them accessible.
If I create an index.html in that folder, it works, but if I create an index.php it does not work.
I use Valet on my dev machine and my website is being deployed with Ploi deploy.

Laravel - Deploy app on Heroku

I am trying to deploy laravel application on heroku. I followed the videos on heroku homepage for deploying a php application. I currently get a 403 error, You don't have permission to access / on this server. How can I change the app permissions in order to run it correctly?
Also how can I access the app from the terminal to apply any changes if possible?
Long time since I use Heroku, but the documentation has what you need. You are getting a 403 because it is likely you are not setting the web root. By default the web root is / which is restricted. In Laravel you need it to be /public
Add a Procfile to the root of your Laravel project and add the following line to it:
web: vendor/bin/heroku-php-apache2 public/
The second part of your question can be achieved by running heroku run bash from the terminal. You may need to specify your app name. However it should be mentioned that its likely your changes would be over written next time you deploy your app.

Change name of heroku application

I just uploaded my application to heroku, when loading the web app in the web browser, the name of the application in the web browser tab is what i called it on my desktop "rails project", for production how could i change this so that it is a proper name, for example "website name"?
If you want to change the name of your app itself on Heroku's platform, open your terminal and enter the following:
heroku apps:rename newname
If you want to change the title that appears in the browser tab, go to your application.html.erb or whatever your layout file is that contains the html doc type and header and enter the title like this:
<title>My New App Name</title>
If you want to change the domain name that you navigate to in your browser, you'll want to enter this on the command line:
heroku domains:add www.example.com
You'll need to add CNAME records to your DNS file that point to Heroku. Their documentation explains it here:
https://devcenter.heroku.com/articles/custom-domains
This is really so simple step. At least it worked for me.
First of all go to your heroku dashboard and choose the app you want to rename. And there you just rename your application like you want. Accept all of the warnings.
Secondly you go to your .git folder of your app folder and then to the config file and open it in a text editor and at url change your app name exactly how you have renamed your dashboard app and don't delete the last .git. And save it.
Third and finally, you just choose the directory on your terminal and just upload your heroku app like you did earlier.
heroku login
git init
git add.
git commit -m "your message"
git push heroku master

How do I use Heroku to host a personal website?

I want to use Heroku to host a website that has HTML, CSS and JS files, along with some jpegs and gifs.
I know how to do this with a Rails application, using;
heroku create --stack cedar
It seems that the cedar stack create a repo that is fit for Rails, Java ect apps because the error message is
Heroku push rejected, no Cedar-supported app detected
And when I try to launch the app it just say; Heroku | Welcome to your new app!
Here is a link: http://afternoon-brook-2543.herokuapp.com/
So I want to know how to put some JS, HTML, CSS and images files to host. Perhaps another command may create a simple website stack?
If you saved your root file as index.php then Heroku will detect it as a PHP application - it doesn't need to actually contain PHP code, just been named that.
If you want to send a personal website into Heroku, create an index.php file connected to your website. Launch the app as it was a PHP app. You will be able to launch the app with ease!
Hope this helped!

Resources