在 linux 中启动 nginx 的步骤:检查 nginx 是否已安装。使用 systemctl start nginx 启动 nginx 服务。使用 systemctl enable nginx 启用在系统启动时自动启动 nginx。使用 systemctl status nginx 验证启动是否成功。在 web 浏览器中访问 http://localhost 查看默认欢迎页面。
要在 Linux 中启动 Nginx,请执行以下步骤:
1. 检查 Nginx 是否已安装
检查 Nginx 是否已经安装在系统上:
$ systemctl status <a style="color:#f60; text-decoration:underline;" href="https://www.php.cn/zt/16000.html" target="_blank">nginx</a>
登录后复制
如果 Nginx 已安装,它将显示“active (running)”。
2. 启动 Nginx 服务
如果 Nginx 未运行或已停止,使用以下命令启动它:
$ systemctl start nginx
登录后复制
3. 启用 Nginx 随系统启动
要使 Nginx 在系统启动时自动启动,请使用以下命令启用它:
$ systemctl enable nginx
登录后复制
4. 验证 Nginx 是否已启动
使用以下命令验证 Nginx 是否已成功启动:
$ systemctl status nginx
登录后复制
它应该显示“active (running)”。
5. 访问 Nginx 默认页面
在 Web 浏览器中打开以下 URL,以验证 Nginx 是否正在运行:
http://localhost
登录后复制
您应该看到 Nginx 默认欢迎页面。
以上就是linux怎么启动nginx的详细内容,更多请关注叮当号网其它相关文章!
文章来自互联网,只做分享使用。发布者:走不完的路,转转请注明出处:https://www.dingdanghao.com/article/534165.html