以前都是lnmp一键安装包,
这次自己 编译安装 才知道lnmp有多么的难受,全是坑,总的来说还是自己基础太差
在上一篇已经说了lnmp的搭建,
这里说一下 nginx的配置 (自己踩了坑)
nginx安装好后默认访问的 是 /usr/local/nginx/html 这个目录
vim /user/local/nginx/conf/nginx.conf
这是我自己的server
server {
listen 80;
server_name 自己的域名;
root /home/project;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
#root /home/project;
index index.html index.htm index.php;
}
#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 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 /home/project;
fastcgi_pass 127.0.0.1:9000; #关联php
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;
#}
}
把server 配置好后
nginx -s reload
重启好后访问
大功告成