0

I am using a Laravel package to connect to a payment system and this particular package sends and receives data via port 80 (and as I use port 8000 to make payments, I will encounter failures).

As seen here:
How to run laravel 5 on port 80 of localhost?

I decided to give it a try but this error is returned:
Failed to listen on 127.0.0.1:80 (reason: Permission denied)

To discover which program is using port 80, I entered sudo lsof -i :80 and received the following output:

COMMAND  PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
apache2 3102     root    4u  IPv6  46970      0t0  TCP *:http (LISTEN)
apache2 3103 www-data    4u  IPv6  46970      0t0  TCP *:http (LISTEN)
apache2 3104 www-data    4u  IPv6  46970      0t0  TCP *:http (LISTEN)
apache2 3105 www-data    4u  IPv6  46970      0t0  TCP *:http (LISTEN)
apache2 3106 www-data    4u  IPv6  46970      0t0  TCP *:http (LISTEN)
apache2 3107 www-data    4u  IPv6  46970      0t0  TCP *:http (LISTEN)
apache2 3108 www-data    4u  IPv6  46970      0t0  TCP *:http (LISTEN)
apache2 3115 www-data    4u  IPv6  46970      0t0  TCP *:http (LISTEN)
apache2 3116 www-data    4u  IPv6  46970      0t0  TCP *:http (LISTEN)
apache2 3117 www-data    4u  IPv6  46970      0t0  TCP *:http (LISTEN)

I also tried the command: sudo netstat -nltp | grep -iw "80" and the following is its output:
tcp6 0 0 :::80 :::* LISTEN 3102/apache2

To free port 80 I tried: sudo kill -9 3102, afterwards I ran:
sudo netstat -nltp | grep -iw "80"
and the output was:
tcp6 0 0 :::80 :::* LISTEN 3330/apache2
(the port is re-occupied).

I very much like to know how I can use port 80 to develop my Laravel app on it (I am using Debian 9 Stretch).

Cœur
  • 37,241
  • 25
  • 195
  • 267
Tower
  • 337
  • 1
  • 4
  • 20

1 Answers1

0

Let me guess. I think you are running artisan server in the server. It's not recommended to run it on your production server. artisan server should only used for development environment.

Based on your explanation, port 80 has been used by apache2 server. That's normal. What you need to do is to put your Laravel application to apache DocumentRoot directory. Because apache2 is the real web server. For Debian like distribution, DocumentRoot for apache2 located at /var/www. You may follow this guide for more information.

Hope it helps.

Mr. Taumal
  • 94
  • 1
  • 8
Dharma Saputra
  • 1,524
  • 12
  • 17