LNMP(linux+nginx+mysql+php)环境搭建_2
来源:互联网 发布:游戏数据分析师bi 编辑:程序博客网 时间:2024/06/04 18:49
配置文件
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
include 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"';
sendfile on;
keepalive_timeout 65;
include extra/blog.conf;
然后
#mkdir extra
#cd extra
#vi blog.conf
配置server
内容如下
1 server {
2 listen 80;
3 server_name blog.etiantian.org;
4 location / {
5 root html/blog;
6 index index.html index.htm;
7 }
8 location ~.*\.(php|php5)?$ {
9 root html/blog;
10 fastcgi_pass 127.0.0.1:9000;
11 fastcgi_index index.php;
12 include fastcgi.conf;
13 }
14 }
#cd /application/nginx/html
#mkdir blog
检查nginx配置语法错误,重启服务
#/application/nginx/sbin/nginx -t
出现语法错误就改!ok和successful就重启
#/application/nginx/sbin/nginx -s reload
重启
⑥测试LNMP环境生效情况
#cd /application/nginx/html/blog
#echo "<?php_phpinfo(); ?>" >test_info.php
windows下配置host解析
host文件在 C:\WINDOWS\system32\drivers\etc
添加 10.0.0.8 blog.etiantian.org
10.0.0.8替换为你linux主机的ip地址
打开浏览器。输入http://blog.etiantian.org/test_info.php
显示php配置信息页面表示环境成功
下面贴图,测试数据库连接和部署blog程序服务的示例,搭建自己的blog网站。最后写一个部署symfony项目到LNMP中的过程。
以上为部署wordpress个人博客步骤
下面为在LNMP中部署sympony项目步骤
①在nginx.conf中添加新的服务器,include extra/education.conf;
②编辑education.conf
填入
1 server {
2 listen 80;
3 server_name xy.education.com;
4 root html/education/web;
5 error_log /var/log/nginx/education.error.log;
6 access_log /var/log/nginx/education.access.log;
7 rewrite ^/app\.php/?(.*)$ /$1 permanent;
8 index index.php index.html index.htm;
9 location / {
10 index app.php;
11 try_files $uri @rewriteapp;
12 }
13 location @rewriteapp {
14 rewrite ^(.*)$ /app.php/$1 last;
15 }
16 location ~ ^/(app|app_dev)\.php(/|$) {
17 fastcgi_pass 127.0.0.1:9000;
18 fastcgi_split_path_info ^(.+\.php)(/.*)$;
19 include fastcgi_params;
20 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
21 fastcgi_param HTTPS off;
22 }
23 }
③项目文件放在html/education下
④授权nginx用户管理项目目录,chown -R nginx.nginx /application/nginx/html/education
⑤此为http的配置,https的自行baidu nginx部署symfony项目
- LNMP(linux+nginx+mysql+php)环境搭建_2
- LNMP(Linux+Nginx+MySQL+PHP)环境搭建
- LNMP(linux+nginx+mysql+php)环境搭建
- LNMP(Linux+nginx+MySQL+PHP)环境搭建
- 搭建LNMP(linux+nginx+mysql+php)服务器环境配置实例教程
- lnmp 环境搭建 源代码包安装 linux,nginx,mysql,php
- centos 下lnmp(linux+nginx+mysql+php)环境搭建
- LNMP(linux+nginx+mysql+php)环境搭建_1
- CentOS7搭建LNMP(Linux+Nginx+MySQL+PHP) 环境
- 源码编译安装,搭建LNMP环境(Linux+Nginx+MySQL+PHP)
- LNMP(linux,Nginx,MySQL,PHP)环境搭建
- linux下搭建LNMP(linux+nginx+mysql+php)环境之nginx安装
- LNMP环境的基础搭建,即Linux、Nginx、MySQL、PHP环境
- 云服务器ECS搭建PHP之LNMP环境(linux+nginx+mysql+php)
- linux下搭建LNMP(linux+nginx+mysql+php)环境之mysql5.5安装
- linux下搭建LNMP(linux+nginx+mysql+php)环境之php5.4安装
- 自己手动搭建lnmp环境、linux+php+nginx环境搭配
- centos linux 下LNMP 环境快速yum搭建(nginx+mysql+memcached+iptables+php)
- javascript基本包装方法
- Linux load average负载量分析与解决思路
- 373. Find K Pairs with Smallest Sums
- nefu118 n!末尾0的个数
- Android SDK 源码解析项目
- LNMP(linux+nginx+mysql+php)环境搭建_2
- linux学习第九篇:安装Tomcat
- 矩阵相关
- POJ2311——Cutting Game(sg函数)
- 1012. The Best Rank (25)-PAT甲级真题
- 程序员代码面试指南 IT名企算法与数据结构题目最优解 ,左程云著
- CentOS6.5 安装 Nginx
- php中$this的引用计数
- python核心编程学习笔记-2016-08-13-03-授权