FreeBSD 10 + Nginx 1.4.4 + PHP 5.5.9 + MySQL 5.6.15

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,集群版 2核4GB 100GB
推荐场景:
搭建个人博客
云数据库 RDS MySQL,高可用版 2核4GB 50GB
简介:

1. PHP 5.5.9

文本格式回复

cd /usr/ports/lang/php55
make install clean; rehash
		

开启下面三个 PHP 编译选项

		
[X] CLI        Build CLI version
[X] CGI        Build CGI version
[X] FPM        Build FPM version (experimental)
		
		

FreeBSD启动是自动开启php-fpm服务

		
cat >> /etc/rc.conf <<EOF
php_fpm_enable="YES"
EOF
		
		

安装PHP扩展

cd /usr/ports/lang/php55-extensions
make install clean; rehash
		

FPM启动脚本

# /usr/local/etc/rc.d/php-fpm start
		

2. MySQL 5.6.15

安装 MySQL server 与 client

		
pkg install mysql56-server
pkg install mysql56-client
		
		

设置mysql root密码

/usr/local/etc/rc.d/mysql-server onestart
/usr/local/bin/mysqladmin -u root password 'newpassword'
		

FreeBSD 启动时开启MySQL服务

		
cat >> /etc/rc.conf <<EOF
mysql_enable="YES"
EOF
		
		

MySQL 启动脚本

# /usr/local/etc/rc.d/mysql-server
		

3. Nginx 1.4.4

所特殊需求,所以采用pkg安装

# pkg install nginx
		

如果需要特别编译模块可以使用ports安装

cd /usr/ports/www/nginx
make install clean; rehash
		

服务开启

		
cat >> /etc/rc.conf <<EOF
nginx_enable="YES"
EOF
		
		

Nginx 启动脚本的位置

# /usr/local/etc/rc.d/nginx start
		

例 1. Nginx 配置文件

/usr/local/etc/nginx/nginx.conf

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


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"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    gzip  on;

	include /usr/local/etc/nginx/conf.d/*.conf;

}
			

/usr/local/etc/nginx/conf.d/host.domain.conf

server {
    listen       80;
    server_name  localhost;

    #charset koi8-r;

    #access_log  logs/host.access.log  main;

    location / {
        root   /usr/local/www/nginx;
        index  index.html 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   /usr/local/www/nginx-dist;
    }

    # 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  /usr/local/www/nginx$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;
    #}
}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
#    listen       8000;
#    listen       somename:8080;
#    server_name  somename  alias  another.alias;

#    location / {
#        root   html;
#        index  index.html index.htm;
#    }
#}


# HTTPS server
#
#server {
#    listen       443;
#    server_name  localhost;

#    ssl                  on;
#    ssl_certificate      cert.pem;
#    ssl_certificate_key  cert.key;

#    ssl_session_timeout  5m;

#    ssl_protocols  SSLv2 SSLv3 TLSv1;
#    ssl_ciphers  HIGH:!aNULL:!MD5;
#    ssl_prefer_server_ciphers   on;

#    location / {
#        root   html;
#        index  index.html index.htm;
#    }
#}
相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
8天前
|
数据库
基于PHP+MYSQL开发制作的趣味测试网站源码
基于PHP+MYSQL开发制作的趣味测试网站源码。可在后台提前设置好缘分, 自己手动在数据库里修改数据,数据库里有就会优先查询数据库的信息, 没设置的话第一次查询缘分都是非常好的 95-99,第二次查就比较差 , 所以如果要你女朋友查询你的名字觉得很好 那就得是她第一反应是查和你的缘分, 如果查的是别人,那不好意思,第二个可能是你。
25 3
|
1月前
|
NoSQL 关系型数据库 MySQL
linux服务器重启php,nginx,redis,mysql命令
linux服务器重启php,nginx,redis,mysql命令
34 1
|
1月前
|
NoSQL 关系型数据库 应用服务中间件
jdk1.8、mysql、redis、nginx centos云服务器安装配置
jdk1.8、mysql、redis、nginx centos云服务器安装配置
|
1月前
|
Ubuntu 关系型数据库 MySQL
ubuntu apt 安装wordpress所需所有的 一键脚本 扩展您的PHP似乎没有安装运行WordPress所必需的MySQL扩展。
ubuntu apt 安装wordpress所需所有的 一键脚本 扩展您的PHP似乎没有安装运行WordPress所必需的MySQL扩展。
26 0
ubuntu apt 安装wordpress所需所有的 一键脚本 扩展您的PHP似乎没有安装运行WordPress所必需的MySQL扩展。
|
1月前
|
前端开发 关系型数据库 MySQL
使用 PHP 和 MySQL 实现留言板功能
使用 PHP 和 MySQL 实现留言板功能
45 0
|
2月前
|
Java 关系型数据库 Docker
docker打包部署spring boot应用(mysql+jar+Nginx)
docker打包部署spring boot应用(mysql+jar+Nginx)
|
1月前
|
关系型数据库 应用服务中间件 nginx
docker基础,docker安装mysql,docker安装Nginx,docker安装mq,docker基础命令
docker基础,docker安装mysql,docker安装Nginx,docker安装mq,docker基础命令
|
3天前
|
缓存 负载均衡 应用服务中间件
nginx配置详解
配置详解
51 24
nginx配置详解
|
4天前
|
缓存 负载均衡 应用服务中间件
nginx配置
nginx配置详解
26 2
nginx配置
|
15天前
|
负载均衡 应用服务中间件 API
深入理解 Nginx 与 Kong 的配置与实践
在微服务架构中,Nginx 用于配置负载均衡,如示例所示,定义上游`pay-service`包含不同权重的服务节点。Kong API 网关则通过service和route进行服务管理和路由,与Nginx的upstream和location类似。通过Kong的命令行接口,可以创建upstream、target、service和route,实现对后端服务的负载均衡和请求管理。Nginx和Kong协同工作,提供高效、灵活的API管理和流量控制。
17 1
深入理解 Nginx 与 Kong 的配置与实践

推荐镜像

更多