我在跟着视频做淘淘商城,在集成fastDFS和nginx的虚拟机上,安装的nginx一直没法用,用localhost访问时一直处于等待的状态,各种办法都试,没有成功,无奈,在此提问,望热心朋友指点一二
虚拟机是centos7,用firefox,一直处于一下状态
这是我安装完查看nginx启动状态的信息,好像和网上教程显示的不一样,我的只有两行,正常的有三行,有没有可能是我的nginx安装有问题
[root@localhost sbin]# ps -ef|grep nginx
root 3102 1 0 13:17 ? 00:00:00 nginx: master process ./nginx
root 4249 4119 0 14:35 pts/1 00:00:00 grep --color=auto nginx
我的nginx.conf还没有修改去添加fdfs,样子如下(我只列出server部分,其他应该不重要吧)
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
防火墙、iptables、换端口都试过了,现在已无力回天,只求大佬赐教!
server {
listen 80;
server_name localhost;
access_log /alidata/log/nginx/localhost.log combined;
error_log /alidata/log/nginx/localhost.log info;
root /alidata/www/htdocs;
index index.html index.htm index.php;
location / {
index index.html index.htm index.php;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
location ~ .+.php(/|$) {
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$ {
expires 7d;
access_log off;
}
}
虚拟机跟宿主机各有各的ip,宿主机上访问localhost是指访问宿主机,访问虚拟机需按ip访问
最好贴下日记. 根据错误提示来处理
看看虚拟机的端口通不通
看一下你监听的端口80是不是和项目的启动的端口不一样啊,你这是访问静态资源吧
看看是否是因为虚拟机端口的问题
两种可能,要不程序的端口正确,可能防火墙开启了
找命令验证一下
你nginx都没产worker进程,看nginx日志,他会告诉你哪错了,百分之八十是fast-nginx-modul的配置文件写错了 很多路径指定不上了