안녕하세요!

엔진엑스와 php7의 설치는 초보인지라 ㅠ_ㅠ

이렇게 자문을 구하고자 글을 올립니다.

centos7 버젼에 nginx 최신버젼 php7.1을 설치했는데.

이상하게 홈페이지에 접속하면 파일을 다운로드 하더라구요.

아마php가 접속이 안되서 그런것 같은데 아무리 구글링이랑 네이벌을 짜집기 해도 도대체가 해결이 안되서 타운에 글을 남겨 봅니다.

사이트는 http://cowardlion.com 입니다!

 

 

 

nginx.conf

 

user  nginx;
worker_processes  auto; 

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  0;

    #gzip  on;
     server_names_hash_bucket_size 64; 
     server_names_hash_max_size 2048;
    include /etc/nginx/conf.d/*.conf;

 

 

 

 

defult.conf

 

server {
    listen       80;
    server_name  localhost;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;

    location / {
        root   /usr/share/nginx/html;
        index index.php index.html index.htm;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000


location ~ [^/]\.php(/|$) {

 # include snippets/fastcgi-php.conf;

  fastcgi_split_path_info ^(.+?\.php)(/.*)$;

  if (!-f $document_root$fastcgi_script_name) {

   return 404;

  }

 # # With php-fpm (or other unix sockets) :

  fastcgi_pass unix:/var/run/php7.0-fpm.sock;

 # # With php-cgi (or other unix sockets) :

 # fastcgi_pass 127.0.0.1:9000;

  fastcgi_index index.php;

  include fastcgi_params;

 }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}

 

 

가상호스트.conf

 

server {
    listen      80 default_server;
    server_name *.cowardlion.com cowardlion.com;
    root        /home/cowardlion/;
    index      index.php index.html;

    charset     utf-8;
    access_log  /var/log/nginx/example-access.log  main;

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
    }

    # deny access to .htaccess files, if Apache's document root concurs with nginx's one
    #
}

 

솔직히 뭐가뭔지 아무것도 모르겠습니다 ㅠ_ㅠ

 

짜집기 한거라 실력이 미흡해도 보고 판단해 주시면 감사드리겠습니다.

 

 

  • profile
    • mist
    • 질문기여자
    아 php-fpm.d / www.conf 입니다.
    user = nginx
    group = nginx

    listen.owner = nginx
    listen.group = nginx
    listen.mode = 0664
  • ?

    Nginx와 php 연동이 제대로 되지않은 것 같습니다.
    제가 아파치와 php7.2 연동할 때 동일한 문제로 애를 먹었었어요 .. ㅠㅠ
    아래 링크를 한번 읽어보세요 ^^

    4번부터 보시면 될 것 같네요
    https://brunch.co.kr/@ninl123/5

  • ? profile
    • mist
    • 질문기여자
    애플님 감사합니다^^! 도움이 팍팍 될것 같습니다!