
linux+nginx+php+mysql安装及配置
提前创建必要的目录: 解压并安装相关组件: 进入 Nginx 安装目录,进行编译: 配置环境变量并编译: 安装完成后启动服务: 解压并安装: 编译并安装: 安装初始化脚本及配置文件: 初始化数据库: 启动或停止数据库: 前 diameter 安装所需依赖组件: 解压并安装 PHP: 编译并安装: 配置 PHP 没有配置文件: 启动 PHPCGI 服务: 将 PHPAdmin 替换目录到与 Nginx 的应用目录下,例如: 重启 Nginx 和 PHP 服务: 使用数据库访问 PHPAdmin,打开
发布日期:2025-04-07 01:40:03
浏览次数:5
分类:精选文章
本文共 3092 字,大约阅读时间需要 10 分钟。
1. 所需安装包
安装 Nginx 和相关扩展组件需要以下软件包:
nginx-1.0.9.tar.gz
nginx_upstream_hash.tar.gz
(Nginx Annunciator 模块)pcre-8.10.tar.gz
(PCRE 正则表达式库)php-5.3.6.tar.bz2
(PHP 5.3.6 版本)mysql-5.1.55.tar.gz
(MySQL 5.1.55 版本)
2. 安装 Nginx
mkdir -p /usr/local/nginx && cd /usr/local/nginx
tar -xzf nginx-1.0.9.tar.gztar -xzf nginx_upstream_hash.tar.gztar -xzf pcre-8.10.tar.gz
cd nginx-1.0.9patch -p0 < /usr/local/nginx/nginx_upstream_hash/nginx.patch
./configure --add-module=/usr/local/nginx/nginx_upstream_hash/ --with-pcre=/usr/local/nginx/pcre-8.10/ --prefix=/usr/local/nginx \ --with-http_stub_status_module --without-select_module --without-poll_module --with-http_realip_module \ --with-http_p_w_picpath_filter_module --with-http_gzip_static_module --with-http_random_index_module \ --with-http_perl_modulemake && make install
/etc/init.d/nginxd start
3. 配置 Nginx 配置文件
将以下内容保存至 /usr/local/nginx/conf/nginx.conf
:
location / { root /usr/local/nginx/html; index index.php index.html index.htm;}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;}
4. 安装 MySQL
tar -xzf mysql-5.1.55.tar.gzcd mysql-5.1.55
./configure --prefix=/usr/local/mysql --with-extra-charsets=all --enable-shared --enable-static \ --with-comment --with-pthread --enable-assembler --with-mysqld-ldflags=-all-static --with-plugins=innobasemake && make install
cp support-files/mysql.server /etc/init.d/mysqldchmod +x /etc/init.d/mysqldcp support-files/my-large.cnf /etc/my.cnfgroupadd mysqluseradd -g mysql mysqlchown -R mysql:mysql /usr/local/mysql/var
/usr/local/mysql/bin/mysql_install_db --user=mysql
/etc/init.d/mysqld start|stop
5. 安装 PHP
yum -y install ntpdate pcre pcre-devel libjpeg-devel libpng libpng-devel freetype freetype-devel curl curl-devel \ compat-libgcc-296 zlib bzip2 bzip2-devel ncurses ncurses-devel openssl openssl-devel
tar -xjf php-5.3.6.tar.bz2cd php-5.3.6
./configure --disable-debug --enable-gd-native-ttf --with-freetype-dir=/usr/lib --enable-safe-mode \ --with-libxml-dir --with-mysql=/usr/local/mysql/ --with-gd --with-zlib-dir \ --with-jpeg-dir --with-png-dir --disable-posix --with-config-file-path=/etc \ --enable-mbstring --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-zip \ --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-curlwrappers --with-gettext \ --enable-shmop --enable-sockets --with-pdo-mysql=/usr/local/mysql/bin/mysql_config \ --with-mcrypt --with-curl --enable-ftpmake && make install
cp php.ini-production /etc/php.ini
/etc/init.d/phpcgi.sh start
6. 安装 PHPAdmin
cp -R /path/to/phpmyadmin˙files/* /usr/local/nginx/html/phpmyadmin
service nginx restartservice php restart
http://IP:80/phpmyadmin
,使用数据库账户登录。发表评论
最新留言
很好
[***.229.124.182]2025年04月26日 23时42分39秒
关于作者

喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
Linux 中的逻辑卷 LVM 管理完整初学者指南
2023-02-01
Linux 使用ab进行压力测试
2023-02-01
linux 使用ifstat查看网络使用情况
2023-02-01
Linux 使用记1 fastx toolkit安装问题
2023-02-01
Linux 内存优化性能实战
2023-02-01
Linux 内存优化性能实战
2023-02-01
Linux 内核 6.11 RC6 发布!
2023-02-01
Linux 内核/sbin/hotplug 工具
2023-02-01
Linux 内核kobject 缺省属性
2023-02-01
Linux 内核交互图
2023-02-01
linux 内核定时器精度_LWN 文章合集之 “内核定时器”
2023-02-01
Linux 内核有soft rdma吗?
2023-02-01
Linux 内核突破 4000 万行代码:创新与挑战并存的里程碑
2023-02-01
Linux 几种文件传输方式
2023-02-01
Linux 创建用户和工作组
2023-02-01
Linux 创建(删除)连接命令 ln -s 软连接
2023-02-01
Linux 利用lsof命令恢复删除的文件
2023-02-01
Linux 利用XShell隧道通过跳板机连接内网服务器
2023-02-01
linux 动态增加inode,如何在Linux中增加磁盘inode号
2023-02-01