docker搭建lnmp環境

 

查看nginx/error.logphp

報錯:primary script unknown nginxhtml

修改nginx網站的配置linux

nginx的config啓動文件:ps  -ef | grep nginxnginx

-v 顯示 nginx 的版本git

-V 顯示 nginx 的版本,編譯器版本和配置參數。github

查找nginx地址:nginx -tdocker

默認的狀況下文件地址在:/etc/nginx/conf.d/default.confcentos

默認配置:swoole

server {
    listen       80;
    server_name  localhost;
    #charset koi8-r;
    #access_log  /var/log/nginx/log/host.access.log  main;
    location / {
        root   /usr/share/nginx/html;
        index  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$ {
    #    root           html;
    #    fastcgi_pass   127.0.0.1:9000;
    #    fastcgi_index  index.php;
    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    #    include        fastcgi_params;
    #}
    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}

 將其修改成:  php7

server {
    listen       80;
    server_name  localhost;
    #charset koi8-r;
    #access_log  /var/log/nginx/log/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$ {
        root           /usr/share/nginx/html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}

 網上說 /scripts 改爲 $document_root,不過仍是沒有識別到

php重啓 sudo service php-fpm restart

nginx重啓:service nginx restart

 

虛擬機host域名配置:

vi /etc/hosts

 

nginx指向域名,項目
vi /usr/local/nginx/conf/nginx.conf server同級再建一個server配置

server {
        listen       80;
        server_name  test1.test;
        location / {
            root   /work/html/;
            index  index.php index.html index.htm;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
        location ~ \.php$ {
            root           /work/html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            #fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
}

  

 

Linux 下hosts文件詳解:https://www.cnblogs.com/xiaoit/p/3989026.html

物理機訪問虛擬機host域名:https://jingyan.baidu.com/article/2d5afd690d7f6d85a2e28ec6.html

 

搭建docker+swoole+php7 的環境(沒什麼用):https://blog.csdn.net/yangqinjiang/article/details/78332682

搭建docker+swoole+php7 的環境 github(沒什麼用):https://github.com/cmptech/auto_cmp_php_docker_server

 

linux centos下安裝docker:http://www.cnblogs.com/rookie404/p/5965518.html

基於Docker部署PHP7開發環境:http://www.mamicode.com/info-detail-2181927.html

Docker學習筆記:http://www.cnblogs.com/52fhy/p/5638571.html

實用github鏡像:https://github.com/52fhy/docker-images/tree/master/php71-fpm-centos68-phalcon-withext

相關文章
相關標籤/搜索