How to start nginx via different port(other than 80)

前端 未结 5 901
梦如初夏
梦如初夏 2020-11-28 01:36

Hi I am a newbie on nginx, I tried to set it up on my server(running Ubuntu 4), which already has apache running.

So after I apt-get install it, I trie

5条回答
  •  隐瞒了意图╮
    2020-11-28 02:08

    You will need to change the configure port of either Apache or Nginx. After you do this you will need to restart the reconfigured servers, using the 'service' command you used.


    Apache

    Edit

    sudo subl /etc/apache2/ports.conf 
    

    and change the 80 on the following line to something different :

    Listen 80
    

    If you just change the port or add more ports here, you will likely also have to change the VirtualHost statement in

    sudo subl /etc/apache2/sites-enabled/000-default.conf
    

    and change the 80 on the following line to something different :

    
    

    then restart by :

    sudo service apache2 restart
    

    Nginx

    Edit

    /etc/nginx/sites-enabled/default
    

    and change the 80 on the following line :

    listen 80;
    

    then restart by :

    sudo service nginx restart
    

提交回复
热议问题