运行 Ubuntu 13.10。

我已将我的网站放入此文件夹中:

并在/srv/www/streamsy.com/logs/上创建日志文件夹。

我已完成以下步骤:

sudo apt-get install nginx 
sudo chown -R www-data:www-data /srv/www/streamsy.com/public_html 
sudo chmod 755 /srv/www 

配置文件如下所示:

/etc/nginx/sites-available/streamsy.com:

server { 
  listen 80; 
  server_name streamsy.com; 
 
  access_log /srv/www/streamsy.com/logs/access.log; 
  error_log /srv/www/streamsy.com/logs/error.log; 
 
  location / { 
      root /srv/www/streamsy.com/public_html/; 
      index index.html; 
  } 
} 

/etc/nginx/nginx.conf:

user www-data; 
worker_processes 4; 
pid /run/nginx.pid; 
 
events { 
  worker_connections 768; 
} 
 
http { 
  sendfile on; 
  tcp_nopush on; 
  tcp_nodelay on; 
  keepalive_timeout 65; 
  types_hash_max_size 2048; 
 
  include /etc/nginx/mime.types; 
  default_type application/octet-stream; 
 
  access_log /var/log/nginx/access.log; 
  error_log /var/log/nginx/error.log; 
 
  gzip on; 
  gzip_disable "msie6"; 
 
 
  include /etc/nginx/conf.d/*.conf; 
  include /etc/nginx/sites-enabled/streamsy.com; 
} 

我已启用 Streamsy.com 文件:

sudo ln -s /etc/nginx/sites-available/streamsy.com /etc/nginx/sites-enabled/streamsy.com 

编辑/etc/hosts,但使用真实IP而不是x:

 127.0.0.1       localhost 
 127.0.1.1       lalle-VM 
 217.72.x.x streamsy.com 

重新启动:

sudo service nginx restart 
 
* Restarting nginx nginx                                                [ OK ] 

结果:

/var/log/nginx/error.log 中没有错误

有人知道我做错了什么吗?谢谢。

请您参考如下方法:

通过在路由器中打开端口 80 解决。


评论关闭
IT源码网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!