Host react app using Apache httpd server on RHEL8

  1. Install Apache Httpd
    You can refer this article for how to setup local yum/dnf repository on RHEL 8.
# dnf install httpd
# systemctl enable httpd
# systemctl start httpd
# systemctl status httpd
# firewall-cmd --zone=public --permanent --add-service=http
# firewall-cmd --reload
# firefox localhost
$ cd myapp
$ npm run build
# cp -rf build/* /var/www/html/
<Directory "/var/www/html">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All

Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.html [QSA,L]


#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
<Directory “/var/www/html”>

AllowOverride All

</Directory>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.html [QSA,L]
# systemctl restart httpd
# firefox localhost
  1. https://gist.github.com/ywwwtseng/63c36ccb58a25a09f7096bbb602ac1de
  2. https://medium.com/r/?url=https%3A%2F%2Flinuxconfig.org%2Finstalling-apache-on-linux-redhat-8

--

--

--

System Administrator and Full stack web developer.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

React Native Eslint + VSCode

JavaScript Functions, a Pocket Reference

Hi guys, What’s up 😃

Gloabal vs Local vs block scope in JavaScript?

How to make an app drawer with React Hooks and CSS

AWS Cognito example using React UI and Node.js REST APIs — part 2 (React UI app with Redux)

Data Visualization with React & amCharts

How To Run and Deploy React with NodeJS Backend on Azure App Services

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Himanshu Pratap

Himanshu Pratap

System Administrator and Full stack web developer.

More from Medium

Push Strapi to Heroku Using Github Repository

Dockerized React Nginx Deploy: A simple starter template.

Deploy a React App to Brilliant Cloud with Docker & Nginx

Hosting Nodejs App using your own Docker Image in Jelastic PaaS/ Yeti Cloud