VPS侦探论坛

 找回密码
 注册
查看: 4429|回复: 1

lnmp配置多域名时不能访问PHP文件

[复制链接]
发表于 2014-1-14 11:44:05 | 显示全部楼层 |阅读模式

如题。a.1010.com:1010/index.html正常
a.1010.com:1010/a.php 错误502


配置文件
a.1010.com.conf


  1. server {  
  2.     listen 1010;  
  3.     server_name a.1010.com;  
  4.     location / {
  5.       root  /home/wwwroot/default/a;
  6.       index index.html index.htm index.php;  
  7.     }


  8.         location ~ ^(.+\.php)(.*)$ {
  9.                         fastcgi_index index.php;
  10.                         fastcgi_split_path_info ^(.+\.php)(.*)$;
  11.                         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  12.                         fastcgi_param PATH_INFO $fastcgi_path_info;
  13.                         fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
  14.                         fastcgi_pass 127.0.0.1:9000;
  15.                         include fcgi.conf;
  16.                 }


  17. }
复制代码





默认配置文件nginx.conf
  1. user  www www;

  2. worker_processes 1;

  3. error_log  /home/wwwlogs/nginx_error.log  crit;

  4. pid        /usr/local/nginx/logs/nginx.pid;

  5. #Specifies the value for maximum file descriptors that can be opened by this process.
  6. worker_rlimit_nofile 51200;

  7. events
  8.         {
  9.                 use epoll;
  10.                 worker_connections 51200;
  11.         }

  12. http
  13.         {
  14.                 include       mime.types;
  15.                 default_type  application/octet-stream;

  16.                 server_names_hash_bucket_size 128;
  17.                 client_header_buffer_size 32k;
  18.                 large_client_header_buffers 4 32k;
  19.                 client_max_body_size 50m;

  20.                 sendfile on;
  21.                 tcp_nopush     on;

  22.                 keepalive_timeout 60;

  23.                 tcp_nodelay on;

  24.                 fastcgi_connect_timeout 300;
  25.                 fastcgi_send_timeout 300;
  26.                 fastcgi_read_timeout 300;
  27.                 fastcgi_buffer_size 64k;
  28.                 fastcgi_buffers 4 64k;
  29.                 fastcgi_busy_buffers_size 128k;
  30.                 fastcgi_temp_file_write_size 256k;

  31.                 gzip on;
  32.                 gzip_min_length  1k;
  33.                 gzip_buffers     4 16k;
  34.                 gzip_http_version 1.0;
  35.                 gzip_comp_level 2;
  36.                 gzip_types       text/plain application/x-javascript text/css application/xml;
  37.                 gzip_vary on;
  38.                 gzip_proxied        expired no-cache no-store private auth;
  39.                 gzip_disable        "MSIE [1-6]\.";

  40.                 #limit_zone  crawler  $binary_remote_addr  10m;

  41.                 server_tokens off;
  42.                 #log format
  43.                 log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '
  44.              '$status $body_bytes_sent "$http_referer" '
  45.              '"$http_user_agent" $http_x_forwarded_for';

  46. server
  47.         {
  48.                 listen       80;
  49.                 server_name www.lnmp.org;
  50.                 index index.html index.htm index.php;
  51.                 root  /home/wwwroot/default;

  52.                 location ~ .*\.(php|php5)?$
  53.                         {
  54.                                 try_files $uri =404;
  55.                                 fastcgi_pass  unix:/tmp/php-cgi.sock;
  56.                                 fastcgi_index index.php;
  57.                                 include fcgi.conf;
  58.                         }

  59.                 location /status {
  60.                         stub_status on;
  61.                         access_log   off;
  62.                 }

  63.                 location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  64.                         {
  65.                                 expires      30d;
  66.                         }

  67.                 location ~ .*\.(js|css)?$
  68.                         {
  69.                                 expires      12h;
  70.                         }

  71.                 access_log  /home/wwwlogs/access.log  access;
  72.         }
  73. include vhost/*.conf;
  74. }
复制代码
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2014-1-14 14:45:02 | 显示全部楼层


fastcgi_pass 127.0.0.1:9000; lnmp又没用端口用这个肯定不行
把你自己添加的server删掉

不知道你去哪里找的配置文件,不明白怎么改直接用 /root/vhost.sh 添加
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-25 09:36 , Processed in 0.025505 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表