linux下nginx+php+mysql环境搭建

linux的php环境安装php+mysql+nginx #Linux 初学 + PHP 环境安装     作者下载地址:https://github.com/centos-bz/EZHTTP          1)首先检验你的服务器是否有 wget 下载命令         如果没有安装 命令 yum -y install wget               2)下载安装包 命令 wget https://github.com/cen 阅读详情
++++++++++++++++++++++++++++++++++++++++++++++
linux下nginx+php+mysql环境搭建
++++++++++++++++++++++++++++++++++++++++++++++
操作系统    : [CentOS6.0]
服务器     : [nginx-1.1.8]
PHP      : [php-5.2.6]
数据库     : [mysql-5.1.59]
++++++++++++++++++++++++++++++++++++++++++++++
准备安装软件(download)
 1>[nginx-1.1.8]
      http://nginx.org/download/nginx-1.1.8.tar.gz
 2>[php-5.2.6]
      http://museum.php.net/php5/php-5.2.6.tar.gz
 3>[php-5.2.6-fpm-0.5.8.diff.gz]
      http://php-fpm.org/downloads/php-5.2.6-fpm-0.5.8.diff.gz
 4>[mysql-5.1.59]
      http://downloads.mysql.com/archives/mysql-5.1/mysql-5.1.59.tar.gz
 5>[libxml2-2.6.30]
      http://download.chinaunix.net/down.php?id=28491&ResourceID=6095&site=1
 6>[libmcrypt-2.5.8]
      http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz/download
 7>[zlib-1.2.3]
      http://sourceforge.net/projects/libpng/files/zlib/1.2.3/zlib-1.2.3.tar.gz/download
 8>[libpng-1.2.31]
      http://files.directadmin.com/services/custombuild/libpng-1.2.31.tar.gz
 9>[jpegsrc.v6b]
      http://download.chinaunix.net/down.php?id=10021&ResourceID=5095&site=1
10>[freetype-2.3.5]
        http://nongnu.askapache.com/freetype/freetype-2.3.5.tar.gz
11>[autoconf-2.61]
        http://ftp.gnu.org/gnu/autoconf/autoconf-2.61.tar.gz
12>[gd-2.0.35]
        http://code.google.com/p/google-desktop-for-linux-mirror/downloads/detail?name=gd-2.0.35.tar.gz&can=2&q=
13>[ncurses-5.6]
        http://ftp.gnu.org/gnu/ncurses/ncurses-5.6.tar.gz
14>[pcre-8.10]
        http://sourceforge.net/projects/pcre/files/pcre/8.10/pcre-8.10.tar.gz/download
15>[openssl-1.0.0e]
        http://www.openssl.org/source/openssl-1.0.0e.tar.gz
+++++++++++++++++++++++++++++++++++++++++++++
1>【安装gcc, gcc-c++】
yum install gcc
yum install gcc-c++
2>【开放80、3306、22端口】
#关闭防火墙
service iptables stop
vi /etc/sysconfig/iptables
#添加
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
#重启防火墙
service iptables restart
3>【建立lamp/src目录, 将源码包上传】
4>【安装libxml2】
tar -zxvf libxml2-2.6.30.tar.gz
cd libxml2-2.6.30
./configure --prefix=/usr/local/libxml2/
make 
make install
5>【安装libmcrypt】
tar -zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure --prefix=/usr/local/libmcrypt/ --enable-ltdl-install
make
make install
6>【安装libxml2-devel】
yum install libxml2-devel
7>【安装zlib】
tar -zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure
make
make install
8>【安装libpng】
tar -zxvf libpng-1.2.31.tar.gz
cd libpng-1.2.31
./configure --prefix=/usr/local/libpng/
make
make install
9>【安装jpegsrc.v6b】
mkdir /usr/local/jpeg6
mkdir /usr/local/jpeg6/bin
mkdir /usr/local/jpeg6/lib
mkdir /usr/local/jpeg6/include
mkdir -p /usr/local/jpeg6/man/man1

tar -zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
make
make install
10>【安装freetype】
tar -zxvf freetype-2.3.5.tar.gz
cd freetype-2.3.5
./configure --prefix=/usr/local/freetype/
make
make install
11>【安装autoconf】
tar -zxvf autoconf-2.61.tar.gz
cd autoconf-2.61
./configure
make
make install
12>【安装gd】
tar -zxvf gd-2.0.35.tar.gz
cd gd-2.0.35
./configure --prefix=/usr/local/gd2/ --with-jpeg=/usr/local/jpeg6/ --with-freetype=/usr/local/freetype/
make
make install
13>【pcre-8.10】
tar -zxvf pcre-8.10.tar.gz
cd pcre-8.10
./configure
make
make install
14>【安装openssl】
tar -zxvf openssl-1.0.0e.tar.gz
cd openssl-1.0.0e
./config --prefix=/usr/local/openssl
make
make install
15>【安装nginx】
groupadd www
useradd -g www www
tar -zxvf nginx-1.1.8.tar.gz
cd nginx-1.1.8
./configure --user=www --group=www --prefix=/usr/local/nginx --with-openssl=/lamp/src/openssl-1.0.0e --with-http_stub_status_module --with-http_ssl_module 
make
make install
16>【安装ncurses】
tar -zxvf ncurses-5.6.tar.gz
cd ncurses-5.6
./configure --with-shared --without-debug --without-ada --enable-overwrite
make
make install
17>【安装mysql】
groupadd mysql
useradd -g mysql mysql
tar -zxvf mysql-5.1.59.tar.gz
cd mysql-5.1.59
./configure --prefix=/usr/local/mysql/ --with-extra-charsets=all
make
make install

cp support-files/my-medium.cnf /etc/my.cnf
/usr/local/mysql/bin/mysql_install_db --user=mysql
chown -R root /usr/local/mysql
chown -R mysql /usr/local/mysql/var
chgrp -R mysql /usr/local/mysql

/usr/local/mysql/bin/mysqld_safe  --user=mysql &
cp /lamp/src/mysql-5.1.59/support-files/mysql.server /etc/rc.d/init.d/mysqld
chown root.root /etc/rc.d/init.d/mysqld
chmod 755 /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
chkconfig --list mysqld
chkconfig --levels 245 mysqld off

#配置mysql
cd /usr/local/mysql
#简单的测试
bin/mysqladmin version
#查看所有mysql参数
bin/mysqladmin Variables
#没有密码可以直接登录本机服务器
bin/mysql -uroot
DELETE FROM mysql.user WHERE Host='localhost' AND User='';
FLUSH PRIVILEGES;
#设置root密码为123456
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456');
#配置可远程连接mysql
use mysql
SELECT user,password,host FROM user;
DELETE FROM user WHERE host='localhsot.localdomain'
DELETE FROM user WHERE host='127.0.0.1';
UPDATE user SET host='%' WHERE user='root';
#重启mysql
service mysqld restart
18>【安装php】
tar -zxvf php-5.2.6.tar.gz
gzip -cd php-5.2.6-fpm-0.5.8.diff.gz | patch -d php-5.2.6 -p1

cd php-5.2.6
./configure --prefix=/usr/local/php/ --with-config-file-path=/usr/local/php/etc/ --with-mysql=/usr/local/mysql/ --with-libxml-dir=/usr/local/libxml2/ --with-jpeg-dir=/usr/local/jpeg6/ --with-freetype-dir=/usr/local/freetype/ --with-gd=/usr/local/gd2/ --with-mcrypt=/usr/local/libmcrypt/ --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-soap --enable-mbstring=all --enable-sockets --enable-fastcgi --enable-fpm
make
make install
cp php.ini-dist /usr/local/php/etc/php.ini
#修改php-fpm.conf
vi /usr/local/php/etc/php-fpm.conf
#查找63,66行将注释去掉
<value name="user">nobody</value>
<value name="group">nobody</value>
#启动php
/usr/local/php/sbin/php-fpm start
19>【nginx配置】
vi /usr/local/nginx/conf/nginx.conf
#在server下找到location / 修改解析PHP文件存放的路径, 修改为:
location / {
        root   /var/www/html;
        index  index.html index.htm index.php;
}
#root表示虚拟目录设置为/var/www/html,增加默认解析index.php
#在server下找到location ~ /.php$ 修改php解释器FastCGI配置,修改为:
location ~ \.php$ {
            root           /var/www/html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /var/www/html$fastcgi_script_name;
            include        fastcgi_params;
}
#将nginx添加到自启动中
echo "/usr/local/nginx/sbin/nginx" >> /etc/rc.d/rc.local
#将php添加到自启动中
echo "/usr/local/php/sbin/php-fpm start" >> /etc/rc.d/rc.local

20>【nginx虚拟主机配置】

vi /usr/local/nginx/conf/nginx.conf
#在http最后一行加入
include    /usr/local/nginx/conf/vhost/dev_localhost.config;
#不带url重写

server {  
	listen 80 default;  
	server_name dev.localhost;  
	access_log logs/dev.access.log;  


	root /var/www/html/dev;  


	server_name_in_redirect off;  


	location / {  
		index index.html index.php;
	}  


	location ~ \.php$ {
		fastcgi_pass   127.0.0.1:9000;
		fastcgi_index  index.php;
		fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
		include        fastcgi_params;
	}
}  

#带url重写(zend framework)
server {
	listen 80;
	server_name dev.localhost;
	access_log logs/dev.access.log;  
		
	root   /var/www/html/dev/code/html;
	location / {
		index index.html index.php;


		if (-e $request_filename ) {
			break;
		}
			
		if ( $request_filename ~* \.(js|ico|gif|jpg|jpeg|xml|swf|txt|png|css|html|htm)$ ) {
			return 404;
		}
			
		rewrite .* index.php;
	}
	location ~ .*\.php$ {
		include fastcgi_params;
		fastcgi_param  SCRIPT_FILENAME    $document_root/index.php;
		#fastcgi_param REQUEST_URI $document_uri?$query_string;
		fastcgi_read_timeout 120;
		fastcgi_pass  127.0.0.1:9000;
		fastcgi_index index.php;
	}
}

#重启nginx
/usr/local/nginx/sbin/nginx -s reload
#重启php
/usr/local/php/sbin/php-fpm restart
LNMP架构环境搭建(Linux+Nginx+Mysql+PHP) 一、LNMP环境介绍 LNMP代表的就是:Linux系统下“Nginx+Mysql+PHP”这种网站服务器架构。Nginx是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP代理服务器。MYSQL是一个小型关系型数据库管理系统。PHP是一种在服务器端执行的嵌入式HTML文本的脚本语言。这4种软件均为免费开源软件,组合到一起,就成为一个免费、高效、扩展性强的网站服务系统。 搭建网站服务器环境有很多可选方案,例如微软的Windows2012、LAMP等... 阅读详情

相关推荐

如何搭建LNMP环境 Linux+Nginx+MySql+Php 来运行wordpress

如何搭建LNMP环境 Linux+Nginx+MySql+Php 来运行wordpress

hgfujffg的博客 664

安装libpng最新库文件---863项目组

安装libpng最新库文件 2.2.6  安装libpng最新库文件 步骤一:进入软件源码包所在目录/usr/local/src/中,解压软件包libpng-1.2.31.tar.gz到当前目录libpng-1.2.31下,并进入libpng-1.2.31目录。命令行如下所示

三少GG 2944

libpng-1.2.31.tar.gz

libpng-1.2.31.tar.gz libpng-1.2.31.tar.gz libpng-1.2.31.tar.gz libpng-1.2.31.tar.gz libpng-1.2.31.tar.gz libpng-1.2.31.tar.gz

【Linux】nginx+mysql+php搭建博客----手把手教程(php7.2版本)

linux从零开始搭建博客

sakulaQaQ的博客 1720

数字蓝牙功放

数字蓝牙功放(TPA3110+BK8000L),基于D类数字功放芯片TPA3116蓝牙功放,HIFI级带滤波15Wx2蓝牙数字功放,支持有线和蓝牙两种音源输入

runweipa的博客 1419

iTunes登录协议逆向与自动化实现

本文详细解析了iTunes登录协议的逆向工程与自动化实现方法,涵盖请求体构造、签名生成和会话管理等关键技术。通过XML结构解析、X-Apple-ActionSignature生成原理及完整登录流程实现,帮助开发者高效完成iTunes自动化登录,提升工作效率。

weixin_26938645的博客 939

LAMP安装库文件(三)

2.2.3  安装libxml2最新库文件步骤一:进入下载的软件源码包所在目录/usr/local/src/下,解压软件包libxml2-2.6.30.tar.gz到当前目录libxml2-2.6.30下,并进入libxml2-2.6.30目录。命令行如下所示。[root@localhost root]# cd /usr/local/src/         //进入软件源码包所在目录  

我的学习记录 967

Windows下Colmap编译安装全攻略:从Boost到CUDA的避坑指南

本文详细介绍了在Windows系统下编译安装Colmap三维重建工具的完整流程与实战经验。针对Boost库版本兼容性、CUDA与Visual Studio的版本匹配等常见难题提供了具体的避坑指南和解决方案,帮助开发者高效完成从环境配置到最终部署的全过程。

weixin_28235513的博客 199

LNMP环境的基础搭建,即Linux、Nginx、MySQL、PHP环境

LNMP环境的基础搭建,即Linux、Nginx、MySQL、PHP环境 注意:#用“//---//” 标记的部分不要。 参考内容: lnmp环境搭建完全手册(四)——lnmp搭建(源码安装) http://blog.youkuaiyun.com/stuartjing/article/details/8124491 nginx的安装 http://www.cnb

qiuling007的专栏 1411

Innovus ECO技巧:用setEcoMode+ecoAddRepeater实现批量buffer替换的5个关键步骤

本文详细介绍了在Cadence Innovus工具中,利用setEcoMode与ecoAddRepeater命令实现高效、批量Buffer/Inverter替换的工程化策略。通过启用批处理模式、构建可维护的替换规则、掌握高级定位技巧以及规避布线陷阱等5个关键步骤,帮助芯片设计工程师在ECO阶段大幅提升修改效率与质量,确保设计稳定签核。

d6e7f8的博客 1119

基于Transformers库的BERT模型:一个文本情感分类的实例解析

简介 本文来讲述BERT应用的一个例子,采用预训练好的BERT模型来进行演示。BERT的库来源于Transformers,这是一个由PyTorch编写的库,其集成了多个NLP领域SOTA的模型,比如bert、gpt-2、transformer xl等,并且可以自由选择已经预训练好的模型参数,我们可以基于这些参数进行进一步的训练调试。 Part 1: 利用BERT基于特征的方式进行建模 1、任务与数...

蓝天白云梦的csdn博客 2万+

搭建 php+mysql+nginx_linux+php+mysql+nginx 测试环境搭建步骤

linux+php+mysql+nginx 测试环境搭建步骤:tar zxvf xxx.tar.gzcd xxx./configuremake &&make installcd ..上面这5步“常规”步骤如无特殊情况将默认忽略安装前先确认没有安装内建的rpm包('rpm -qa | grep xxx'[mysql、php、nginx]),如果有最好使用rpm -e xxx卸载。安装...

weixin_42297591的博客 138

抓包网络调试工具 reqable抓包教程

如果CA根证书未安装成功,网络图标是黄色,点击盾牌图标可以进入CA根证书安装界面,详细步骤请阅读。在API调试中,获取流量是第一步也是最基本的操作,这里讲解下如何使用Reqable获取流量,通俗地讲就是抓包。我们可以选择一个图片请求,双击打开详情面板,能够看到该请求的详细信息。如果系统代理未设置,网络图标是黄色,点击网络图标可以自动设置系统代理。此域名的结构树,可以查看该域名下所有请求的目录结构,点击选择可以查看该请求的详情。首先,需要启用Reqable的调试功能,点击最右上角的。打开浏览器,输入地址。

代码简单说 Vue、JAVA、PHP、Node.js 熟练运用,接口、架构、性能全搞定。 2559

LNMP环境的搭建(linux+nginx+mysql+php)

目录LNMP架构介绍搭建步骤安装yum源和安装rpel源安装nginx并配置服务安装mysql数据库安装PHP环境如不能访问网页如何排查 LNMP架构介绍 LNMP架构和LAMP架构很像,只不过一个用的是Apache,一个用的是Nginx。LNMP就是Linux+Nginx+MySQL+PHP,Nginx和Apache一样都是web服务器。 有一点不同的是在LNMP结构里php会启动一个服务:ph...

whoim_i的博客 1960

基于Simulink的自适应反步法(Adaptive Backstepping)控制​

本文针对非线性系统控制中未知参数和强非线性耦合的挑战,提出基于Simulink的自适应反步法解决方案。通过融合参数在线估计与反步递归设计,该方法显著提升了永磁同步电机(PMSM)速度控制的鲁棒性,使跟踪误差从20%降至3%,参数估计收敛时间小于0.5秒。文章详细阐述了从算法推导到Simulink实现的完整流程,包括系统架构设计、核心算法推导(以PMSM为例)、模块化建模方法、参数优化策略以及工程部署建议。提供的自适应控制器MATLAB代码和关键参数表可直接应用于实际工程,为电机驱动、机械臂等非线性系统控制提

xiaoheshang_123的博客 101

深入理解SQL注入中的union select 1,2,3....

UNION 用于合并两个查询的结果集

渗透之路,攻防之间皆学问 2万+

linux php+nginx+mysql,linux下nginx+php+mysql环境搭建

(更新:前后字体不一样,不知道为什么,不太会设置新浪博客这个字体)linux下nginx+php+mysql环境搭建/*****************************************/机器:centos 6.5nginx:nginx-1.1.8php:php-5.6.31mysql:5.1.59/*****************************************/...

weixin_39723655的博客 311

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

最新LNMP环境搭建(Linux+Nginx+MySql+PHP)

  更新系统软件(非必须) yum update [root@localhost ~]# yum update   一、Nginx编译安装 安装依赖 rpm -qa gcc 查看是否安装gcc(执行完命令什么都没出现即为没有安装) 否则安装 [root@localhost nginx-1.14.2]# rpm -qa gcc [root@localhost nginx-1.14...

Ascexz的博客 1114

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

LNMP环境搭建 —— Linux + Nginx + MySQL + PHP

LNMP定义 基于Linux操作系统,以Nginx作为web服务器,Mysql作为数据库。Nginx会直接处理静态请求,因为Nginx本身不具备处理动态请求能力,它会把用户的动态请求交给php服务(php-fpm)去处理,php服务可以和数据库进行交互,将结果返回给Nginx,最终返回给用户 流程: 静态请求:client -> nginx(location) -> html -...

dsd的博客 1393

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

linux安装nginx php mysql_linux下nginx+php+mysql环境搭建

++++++++++++++++++++++++++++++++++++++++++++++linux下nginx+php+mysql环境搭建++++++++++++++++++++++++++++++++++++++++++++++操作系统    : [CentOS6.0]服务器     : [nginx-1.1.8]PHP      : [php-5.2.6]数据库     : [mysql-...

weixin_39668199的博客 271

linux搭建php和mysql数据库_MySQL数据库之web环境搭建之Linux--nginx-php-mysql

本文主要向大家介绍了MySQL数据库之web环境搭建之Linux--nginx-php-mysql ,通过具体的内容向大家展现,希望对大家学习MySQL数据库有所帮助。环境:LinuxCentsOs6.732位任务:搭建web环境:Linux--nginx-php-mysql(1)安装PHP包括一些附加件:1yuminstallphpphp-mysqlphp-gdphp-imapp...

weixin_30962449的博客 233

lnmp环境搭建完成 php,LNMP环境搭建(linux+Nginx + Mysql + PHP)

一、傻瓜式一键安装为了让大家安装环境能简单,方便。有人把它们集成了一个包。1、LNMP一键安装包网址:lnmp.org,里面介绍一些要求,功能等进入到安装页面说明,找到相关的安装说明,运行,然后一步一步按照操作就行了,比较简单2、使用宝塔,这是更加傻瓜,方便的一款工具,操作服务,只需在网站后台,点点鼠标,就能完成网址:bt.cn找到,linux安装,里面有各个系统的安装命令,运行与你系统相关的命令...

weixin_34550722的博客 238

odp 加固 mysql_Linux搭建nginx+php/php-fpm+mysql环境

百度内部php框架odp有单独的nginx+php/php-fpm环境,但为了更好的实践,自己搭建一套单独的。1.首先安装nginx两种方式:1)yum源安装(使用root权限)yum install nginx2)使用源码编译安装(可以root或者普通用户安装,普通用户安装的时候要注意指定安装路径)tar xzvf nginx.tar.gz./configure --prefix=xxxxmak...

weixin_33729662的博客 356

centos7 Linux+Nginx+mysql+php环境搭建

uiyaIchangcentos7 LNMP搭建mantis.note一.下载并解压PHP安装包 # cd /usr/local/src # wget http://cn2.php.net/get/php-7.2.4.tar.xz/from/this/mirror # tar -xvf mirror 二.安装PHP # cd cd php-7.2.4/ 安装PHP相关依赖 # yum -y install libjpeg libjpeg-devel libpng libpng-devel.

gzytester的博客 423

linux搭建lnnp_LNMP环境搭建(linux+Nginx + Mysql + PHP)

linux+Nginx + Mysql + PHP 搭配可以说目前使用比较广泛那要想在这台刚安装好系统的服务器上配置这环境,有多种方式一、傻瓜式一键安装为了让大家安装环境能简单,方便。有人把它们集成了一个包。1、LNMP一键安装包网址:lnmp.org,里面介绍一些要求,功能等进入到安装页面说明,找到相关的安装说明,运行,然后一步一步按照操作就行了,比较简单2、使用宝塔,这是更加傻瓜,方便的一款工...

weixin_39823299的博客 347
上一篇: linux下subversion+apache安装
下一篇: php 获取时间(今天,昨天,三天内,本周,上周,本月,三年内,半年内,一年内,三年内)
ihelloworld
博客等级 码龄16年 5粉丝 24原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值