Home >Operation and Maintenance >Nginx >How to install Nginx server on Ubuntu
Install nginx
sudo apt-get install nginx
If you have installed apache and apache is running at this time, please modify the configuration file first (students who do not have it will skip it directly):
#打开配置文件 sudo vim /etc/nginx/sites-available/default
Then make the following two modifications (in order not to conflict with apache):
server { #修改这里 我将 80 改为 88 listen 88 default_server; #还有这里 同样改为你想要的监听端口 listen [::]:88 default_server ipv6only=on; .....
At this point, we test whether nginx is successfully installed. If you have not made the above modifications, enter localhost directly in the browser. If you have changed it, remember to add the port. Mine is localhost:88. If the following interface appears, the installation is successful:
nginx startup and shutdown
Start nginx:
# nginx -c /etc/nginx/nginx.conf 关闭 nginx # nginx -s stop 重读配置文件 # nginx -s reload # pkill -hup nginx 重新打开日志文件 # nginx -s reopen # pkill -usr1 nginx 还可以下载 nginx rpm 包中的 /etc/init.d/nginx 文件,修改路径后即可使用: # service nginx {start|stop|status|restart|reload|configtest|}
The above is the detailed content of How to install Nginx server on Ubuntu. For more information, please follow other related articles on the PHP Chinese website!