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

前端 未结 5 896
梦如初夏
梦如初夏 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 01:58

    You have to go to the /etc/nginx/sites-enabled/ and if this is the default configuration, then there should be a file by name: default.

    Edit that file by defining your desired port; in the snippet below, we are serving the Nginx instance on port 81.

    server {
        listen 81;
    }
    

    To start the server, run the command line below;

    sudo service nginx start
    

    You may now access your application on port 81 (for localhost, http://localhost:81).

提交回复
热议问题