logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: React app is being served by Apache from localhost, but not
Author
nigelsperinck



Joined: 07 Oct 2019
Posts: 2
Location: UK

PostPosted: Mon 07 Oct '19 13:51    Post subject: React app is being served by Apache from localhost, but not Reply with quote

Dear Apache experts,

I have built a HelloWorld React app using create-react-app.

I have used node to successfully create the development and production build versions.

npm start successfully launches HelloWorld React development app in localhost:3000

npm run-script build successfully creates production build

serve -s build successfully launches HelloWorld React production static app in localhost:5000

I have tried to deploy this to Apache running on a local Linux CentOS 7 server.

My background is software development, not Apache systems administration.

The Operating System is Linux CentOS 7

The Apache version is Server version Apache/2.4.6 (CentOS)

Apache is install and running OK.

Apache is successfully serving the HelloWorld React production static app from localhost

However, the issue is that the HelloWorld React production static app is not being served from http://purereact_helloworld.com or http://www.purereact_helloworld.com

The HelloWorld React production app is only being served by Apache because I have copied all the build files from:
home/developer/React_PureReact/react-hello/build
to:
/var/www/purereact_helloworld.com/html

Mozilla Firefox Browser
localhost
Hello World [from purereact_helloworld create-react-app]
OK
Mozilla Firefox Browser
http://purereact_helloworld.com
http://www.purereact_helloworld.com
ERROR, the same error as above
Sorry the website pureact_helloworld.com cannot be found, 404

/etc/httpd/logs/error_log
Code:

[Sun Oct 06 01:57:06.153599 2019] [mpm_prefork:notice] [pid 1535] AH00170: caught SIGWINCH, shutting down gracefully
[Sun Oct 06 01:57:07.254648 2019] [core:notice] [pid 7053] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
[Sun Oct 06 01:57:07.256271 2019] [suexec:notice] [pid 7053] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Sun Oct 06 01:57:07.256399 2019] [ssl:debug] [pid 7053] ssl_engine_pphrase.c(181): AH02199: SSL not enabled on vhost PXEClient-Arch-00000-UNDI-002001-b0-83-fe-e3-4e-d1.home:80, skipping SSL setup
[Sun Oct 06 01:57:07.256422 2019] [ssl:info] [pid 7053] AH01887: Init: Initializing (virtual) servers for SSL
[Sun Oct 06 01:57:07.256434 2019] [ssl:info] [pid 7053] AH01876: mod_ssl/2.4.6 compiled against Server: Apache/2.4.6, Library: OpenSSL/1.0.2k
[Sun Oct 06 01:57:07.301982 2019] [slotmem_shm:debug] [pid 7053] mod_slotmem_shm.c(448): AH02301: attach looking for /run/httpd/slotmem-shm-mod_heartmonitor.shm

I would be very grateful for any suggestions or advice of any further information required to troubleshoot this issue.

Very best regards
Nigel

The following have been included:

/etc/httpd/conf/httpd.conf [https://apaste.info/TLzQ]
/etc/httpd/conf.d/vhost.conf [https://apaste.info/YO5V]
/etc/httpd/conf.d/purereact_helloworld.com.conf [https://apaste.info/CkLl]

httpd -S

Code:

VirtualHost configuration:
*:80                   www.purereact_helloworld.com (/etc/httpd/sites-enabled/purereact_helloworld.com.conf:3)
ServerRoot: "/etc/httpd"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/etc/httpd/logs/error_log"
Mutex default: dir="/run/httpd/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex authdigest-opaque: using_defaults
Mutex proxy-balancer-shm: using_defaults
Mutex rewrite-map: using_defaults
Mutex authdigest-client: using_defaults
Mutex ssl-stapling: using_defaults
Mutex proxy: using_defaults
Mutex authn-socache: using_defaults
Mutex ssl-cache: using_defaults
PidFile: "/run/httpd/httpd.pid"
Define: _RH_HAS_HTTPPROTOCOLOPTIONS
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="apache" id=48 not_used
Group: name="apache" id=48 not_used

Mozilla Firefox Browser
localhost
Hello World [from purereact_helloworld create-react-app]
OK
Mozilla Firefox Browser
http://purereact_helloworld.com
http://www.purereact_helloworld.com
ERROR, the same error as above
Sorry the website pureact_helloworld.com cannot be found, 404

/etc/httpd/logs/error_log

Code:

[Sun Oct 06 01:57:06.153599 2019] [mpm_prefork:notice] [pid 1535] AH00170: caught SIGWINCH, shutting down gracefully
[Sun Oct 06 01:57:07.254648 2019] [core:notice] [pid 7053] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
[Sun Oct 06 01:57:07.256271 2019] [suexec:notice] [pid 7053] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Sun Oct 06 01:57:07.256399 2019] [ssl:debug] [pid 7053] ssl_engine_pphrase.c(181): AH02199: SSL not enabled on vhost PXEClient-Arch-00000-UNDI-002001-b0-83-fe-e3-4e-d1.home:80, skipping SSL setup
[Sun Oct 06 01:57:07.256422 2019] [ssl:info] [pid 7053] AH01887: Init: Initializing (virtual) servers for SSL
[Sun Oct 06 01:57:07.256434 2019] [ssl:info] [pid 7053] AH01876: mod_ssl/2.4.6 compiled against Server: Apache/2.4.6, Library: OpenSSL/1.0.2k
[Sun Oct 06 01:57:07.301982 2019] [slotmem_shm:debug] [pid 7053] mod_slotmem_shm.c(448): AH02301: attach looking for /run/httpd/slotmem-shm-mod_heartmonitor.shm

Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Mon 07 Oct '19 18:35    Post subject: Reply with quote

Please post your vhost config
Back to top
nigelsperinck



Joined: 07 Oct 2019
Posts: 2
Location: UK

PostPosted: Thu 10 Oct '19 4:10    Post subject: React app is being served by Apache from localhost, but not Reply with quote

As requested by James Blond:

# /etc/httpd/conf.d/vhost.conf

NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@purereact_helloworld.com
ServerName purereact_helloworld.com
ServerAlias www.purereact_helloworld.com
DocumentRoot /var/www/purereact_helloworld.com/html/
ErrorLog /var/www/purereact_helloworld.com/log/error.log
CustomLog /var/www/purereact_helloworld.com/log/access.log combined
. </VirtualHost>


/etc/httpd/conf.d/vhost.conf
https://apaste.info/YO5V

/etc/httpd/conf/httpd.conf
https://apaste.info/TLzQ

/etc/httpd/conf.d/purereact_helloworld.com.conf https://apaste.info/CkLl
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Thu 10 Oct '19 16:23    Post subject: Reply with quote

In your purereact_helloworld.com.conf is the directory block missing. Secondly NameVirtualHost *:80 needs to be defined only once (okay it doesn't stop apache from doing its thing).

Code:

<VirtualHost *:80>
   ServerAdmin webmaster@purereact_helloworld.com
   ServerName purereact_helloworld.com
   ServerAlias www.purereact_helloworld.com

   ErrorLog /var/www/purereact_helloworld.com/log/error.log
   CustomLog /var/www/purereact_helloworld.com/log/access.log combined

   DocumentRoot /var/www/purereact_helloworld.com/html/
   <Directory /var/www/purereact_helloworld.com/html/>

      Options Indexes FollowSymLinks MultiViews
      AllowOverride None
      Require all granted
   </Directory>

</VirtualHost>
Back to top


Reply to topic   Topic: React app is being served by Apache from localhost, but not View previous topic :: View next topic
Post new topic   Forum Index -> Apache