Nginx 遇到的问题

嘉美伯爵

运维 Nginx 295

部署问题

Nginx: [error] open() "/usr/local/Nginx/logs/Nginx.pid" failed(2:No such file or directory)

解决:/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

nginx:[emerg]unknown directive "ssl"

# 在nginx解压包路径下执行
yum -y install openssl openssl-devel
./configure
./configure --with-http_ssl_module
make
cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
cp objs/nginx /usr/local/nginx/sbin/nginx

Ubuntu 部署问题

  • /etc/nginx/conf.d/nginx.conf 默认配置
  • /etc/nginx/sites-available/default 默认localhost配置
  • /var/www/html/ 默认工作目录,http://localhost/index.nginx-debian.html 默认欢迎页全url
  • 编辑 /etc/nginx/sites-available/default root那行,目录改成自己的目录即可。

参考文档