How can I run a Spring Boot application on port 80

前端 未结 6 1713
广开言路
广开言路 2020-12-02 10:43

I can\'t start an application on port 80.

I have tried on my local computer (using my IDE, and on a local server), no luck.

I have checked other similar pos

6条回答
  •  感情败类
    2020-12-02 11:06

    Here are steps I followed on centos.

    Step 1 (Optional): Set port

    By default spring boot app run on port 8080, if you wish to change this you can change on your src/main/resources/application.properties file

    server.port = 8082 // any port above than 1024
    

    Step 2: Install apache if not installed already

    On Centos 7

    sudo yum install httpd
    

    Step 3: Edit your virtual host

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

    Your config should look like this

    
       ServerName yourdomin.com
       #DocumentRoot /var/www/html
    
       ProxyPreserveHost On
       ProxyPass / http://localhost:8082/
       ProxyPassReverse / http://localhost:8082/
    
    

    And restart apache

    sudo service httpd restart
    

提交回复
热议问题