Cannot correctly deploy my web app with apache

Hi, I have a streamlit app that runs OK on my linux server (Red Hat 4.8.5),but I have problem deploying it with apache.
System information: Linux version 3.10.0-1062.9.1.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) ) #1 SMP Fri Dec 6 15:49:49 UTC 2019
Apache version: Server version: Apache/2.4.6 (CentOS) Server built: Apr 2 2020 13:13:23
I’ve set the default sever port to 8080, and after refering https://discuss.streamlit.io/t/configuring-apache-2-4-for-proxy/1866, I tried to add a file called default-site.conf in the folder /etc/httpd/conf.d (no folders like sites-enabled were found), and edited it as below:

    <VirtualHost *:80>
        Alias /static/ /data/secondstrpred
        <Directory /data/secondstrpred>
            Require all granted
        </Directory>
        RewriteEngine on
        RewriteCond %{HTTP:Upgrade} =websocket
        RewriteRule /(.*) ws://192.168.1.10:8080/$1 [P]
        RewriteCond %{HTTP:Upgrade} !=websocket
        RewriteRule /(.*) http://192.168.1.10:8080/$1 [P]
        ProxyPassReverse / http://192.168.1.10:8080
    </VirtualHost>

then I ran service httpd restart and run my app from corresponding directory:
streamlit run prediction.py, and it showed the URL I expected,but can only be accessed locally through Xmanager. When I enter the link in the browser of my PC it said β€˜this site cannot be accessed.’
I have to admit that I do not know much of web app deployment, so I would be quite grateful if someone could solve my problem.Thanks in advance.

Hi @kieran_dev_0525, welcome to the Streamlit Community!

If your app works from Xmanager, that suggests to me that you might have a firewall issue. For your server, is port 8080 open to external traffic?

Best,
Randy

Yes @randyzwitch, you’re right. The only problem here is that I did not check whether this port was added to the firewall. And after I made it open, the site becomes avaliable from my PC now. Next time I shall bear this in mind.

1 Like