-1

first i installed apache on my local system, it working fine and then for some reason i installed nginx it also works fine, but now problem is each time when i start my system by default nginx is running on my system then i have to stop nginx using

sudo service nginx stop

and then start apache manually by using

sudo service apache2 start

but i want to change it to apache by default.

NOTE: I don't want to add any startup script.

1 Answers1

1

you can change the listen directives for apache to port 80 and nginx to port 8080

on your http.conf/apache.conf

Listen 80
...

on your nginx.conf

Server {
    Listen 8080
    ...
alexander.polomodov
  • 1,060
  • 3
  • 10
  • 14
nobayz
  • 11
  • 3
  • > nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2018-11-16 13:22:34 IST; 36s ago –  Nov 16 '18 at 07:59
  • > apache2.service - LSB: Apache2 web server Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled) Drop-In: /lib/systemd/system/apache2.service.d └─apache2-systemd.conf Active: inactive (dead) since Fri 2018-11-16 13:22:39 IST; 39s ago –  Nov 16 '18 at 07:59
  • when i check status it gives above. nginx(running) and apache(dead) –  Nov 16 '18 at 08:03
  • do the following command: lsof -i TCP:80 then kill every process that running after that restart apache and nginx – nobayz Nov 16 '18 at 08:14