é 置好IPãDNS ãç½å ³ï¼ç¡®ä¿ä½¿ç¨è¿ç¨è¿æ¥å·¥å ·è½å¤è¿æ¥æå¡å¨
é ç½®é²ç«å¢ï¼å¼å¯80端å£ã3306端å£
vi /etc/sysconfig/iptables #ç¼è¾é²ç«å¢é ç½®æ件
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPTï¼å 许80端å£éè¿é²ç«å¢ï¼
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPTï¼å 许3306端å£éè¿é²ç«å¢ï¼
ç¹å«æ示ï¼å¾å¤ç½åæè¿ä¸¤æ¡è§åæ·»å å°é²ç«å¢é ç½®çæåä¸è¡ï¼å¯¼è´é²ç«å¢å¯å¨å¤±è´¥ã
æ£ç¡®çåºè¯¥æ¯æ·»å å°é»è®¤ç22端å£è¿æ¡è§åçä¸é¢ï¼æ·»å 好ä¹åé²ç«å¢è§åå¦ä¸æ示ï¼
#########################################################
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-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 -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
#########################################################
/etc/init.d/iptables restart #æåéå¯é²ç«å¢ä½¿é ç½®çæ
å ³éSELINUX
vi /etc/selinux/config #ç¼è¾
#SELINUX=enforcing #注éæ
#SELINUXTYPE=targeted #注éæ
SELINUX=disabled #å¢å
:wq #ä¿åéåº
shutdown -r now #éå¯ç³»ç»
ç³»ç»çº¦å®
软件æºä»£ç å åæ¾ä½ç½®ï¼/usr/local/src
æºç å ç¼è¯å®è£ ä½ç½®ï¼/usr/local/软件åå
ä¸è½½è½¯ä»¶å
1.ä¸è½½nginx
http://nginx.org/download/nginx-1.2.0.tar.gz
2ãä¸è½½pcre ï¼æ¯ænginx伪éæï¼
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz
3ãä¸è½½MySQLï¼ç®å稳å®çï¼
http://mysql.mirror.kangaroot.net/Downloads/MySQL-5.5/mysql-5.5.25.tar.gz
ç±äºçæ¬æ´æ°å¯è½ä»¥åçæ¬å·²ä¸åå¨ï¼å¯http://mysql.mirror.kangaroot.net/Downloadsä¸è½½ç¸åºçæ¬ã
4ãä¸è½½php
5ãä¸è½½cmakeï¼MySQLç¼è¯å·¥å ·ï¼
http://www.cmake.org/files/v2.8/cmake-2.8.8.tar.gz
6ãä¸è½½libmcryptï¼PHPlibmcrypt模åï¼
ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz
å®è£ ç¼è¯å·¥å ·ååºæ件ï¼ä½¿ç¨CentOS yumå½ä»¤å®è£ ï¼
yum install make apr* autoconf automake curl-devel gcc gcc-c++ zlib-devel openssl openssl-devel pcre-devel gd kernel keyutils patch perl kernel-headers compat* mpfr cpp glibc libgomp libstdc++-devel ppl cloog-ppl keyutils-libs-devel libcom_err-devel libsepol-devel libselinux-devel krb5-devel zlib-devel libXpm* freetype libjpeg* libpng* php-common php-gd ncurses* libtool* libxml2 libxml2-devel patch freetype-devel
å®è£ ç¯
å®è£ cmake
cd /usr/local/src
tar zxvf cmake-2.8.8.tar.gz
cd cmake-2.8.8
./configure make #ç¼è¯
make install #å®è£
å®è£ MySQL
groupadd mysql #æ·»å mysqlç»
useradd -g mysql mysql -s /bin/false #å建ç¨æ·mysql并å å ¥å°mysqlç»ï¼ä¸å 许mysqlç¨æ·ç´æ¥ç»å½ç³»ç»
mkdir -p /data/mysql #å建MySQLæ°æ®åºåæ¾ç®å½
chown -R mysql:mysql /data/mysql #设置MySQLæ°æ®åºç®å½æé
mkdir -p /usr/local/mysql #å建MySQLå®è£ ç®å½
cd /usr/local/src
tar zxvf mysql-5.5.25.tar.gz #解å
cd mysql-5.5.25
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/etc #é ç½®
make #ç¼è¯
make install #å®è£
cd /usr/local/mysql
cp ./support-files/my-huge.cnf /etc/my.cnf #æ·è´é ç½®æ件ï¼æ³¨æï¼å¦æ/etcç®å½ä¸é¢é»è®¤æä¸ä¸ªmy.cnfï¼ç´æ¥è¦çå³å¯ï¼
vi /etc/my.cnf #ç¼è¾é ç½®æ件,å¨ [mysqld] é¨åå¢å ä¸é¢ä¸è¡
datadir = /data/mysql #æ·»å MySQLæ°æ®åºè·¯å¾
:wq! #ä¿åéåº
./scripts/mysql_install_db --user=mysql #çæmysqlç³»ç»æ°æ®åº
cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld #æMysqlå å ¥ç³»ç»å¯å¨
chmod 755 /etc/init.d/mysqld #å¢å æ§è¡æé
chkconfig mysqld on #设置å¼æºå¯å¨
vi /etc/rc.d/init.d/mysqld #ç¼è¾
basedir = /usr/local/mysql #MySQLç¨åºå®è£ è·¯å¾
datadir = /data/mysql #MySQlæ°æ®åºåæ¾ç®å½
service mysqld start #å¯å¨
vi /etc/profile #æmysqlæå¡å å ¥ç³»ç»ç¯å¢åéï¼å¨æåæ·»å ä¸é¢è¿ä¸è¡
export PATH=$PATH:/usr/local/mysql/bin
:wq! #ä¿åéåº
ä¸é¢è¿ä¸¤è¡æmyslqçåºæ件é¾æ¥å°ç³»ç»é»è®¤çä½ç½®ï¼å¨ç¼è¯ç±»ä¼¼PHPç软件æ¶å¯ä»¥ä¸ç¨æå®mysqlçåºæ件å°åã
ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
ln -s /usr/local/mysql/include/mysql /usr/include/mysql
shutdown -r now #éè¦éå¯ç³»ç»ï¼çå¾ ç³»ç»éæ°å¯å¨ä¹å继ç»å¨ç»ç«¯å½ä»¤è¡ä¸é¢æä½
mysql_secure_installation #设置Mysqlå¯ç
æ ¹æ®æ示æY å车ï¼é»è®¤å¯ç 为空ï¼
ç¶åè¾å ¥2次å¯ç
继ç»æY å车ï¼ç´å°è®¾ç½®å®æ
æè ç´æ¥ä¿®æ¹å¯ç /usr/local/mysql/bin/mysqladmin -u root -p password "123456" #ä¿®æ¹å¯ç
service mysqld restart #éå¯
å°æ¤ï¼mysqlå®è£ å®æ
å®è£ pcre
cd /usr/local/src
mkdir /usr/local/pcre #å建å®è£ ç®å½
tar zxvf pcre-8.30.tar.gz
cd pcre-8.30
./configure --prefix=/usr/local/pcre #é ç½®
make
make install
å®è£ nginx
cd /usr/local/src
groupadd www #æ·»å wwwç»
useradd -g www www -s /bin/false #å建nginxè¿è¡è´¦æ·www并å å ¥å°wwwç»ï¼ä¸å 许wwwç¨æ·ç´æ¥ç»å½ç³»ç»
tar zxvf nginx-1.2.0.tar.gz
cd nginx-1.2.0
./configure --prefix=/usr/local/nginx --without-http_memcached_module --user=www --group=www --with-http_stub_status_module --with-openssl=/usr/ --with-pcre=/usr/local/src/pcre-8.30
#注æ:--with-pcre=/usr/local/src/pcre-8.30æåçæ¯æºç å 解åçè·¯å¾ï¼èä¸æ¯å®è£ çè·¯å¾ï¼å¦åä¼æ¥é
make
make install
/usr/local/nginx/sbin/nginx #å¯å¨nginx
vi /etc/rc.d/init.d/nginx #设置nginxå¼å¯å¯å¨ï¼ç¼è¾å¯å¨æ件添å ä¸é¢å 容
#################################################################
#!/bin/bash
# nginx Startup script for the Nginx HTTP Server
# it is v.0.0.2 version.
# chkconfig: - 85 15
# description: Nginx is a high-performance web and proxy server.
# It has a lot of features, but it's not for everyone.
# processname: nginx
# pidfile: /var/run/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf
nginxd=/usr/local/nginx/sbin/nginx
nginx_config=/usr/local/nginx/conf/nginx.conf
nginx_pid=/usr/local/nginx/logs/nginx.pid
RETVAL=0
prog="nginx"
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -x $nginxd ] || exit 0
# Start nginx daemons functions.
start() {
if [ -e $nginx_pid ];then
echo "nginx already running...."
exit 1
fi
echo -n $"Starting $prog: "
daemon $nginxd -c ${nginx_config}
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
return $RETVAL
}
# Stop nginx daemons functions.
stop() {
echo -n $"Stopping $prog: "
killproc $nginxd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /usr/local/nginx/logs/nginx.pid
}
reload() {
echo -n $"Reloading $prog: "
#kill -HUP `cat ${nginx_pid}`
killproc $nginxd -HUP
RETVAL=$?
echo
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
stop
start
;;
status)
status $prog
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|reload|status|help}"
exit 1
esac
exit $RETVAL
#################################################################
:wq! #ä¿åéåº
chmod 775 /etc/rc.d/init.d/nginx #èµäºæ件æ§è¡æé
chkconfig nginx on #设置å¼æºå¯å¨
/etc/rc.d/init.d/nginx restart #éå¯
å®è£ libmcrypt
cd /usr/local/src
tar zxvf libmcrypt-2.5.7.tar.gz #解å
cd libmcrypt-2.5.7 #è¿å ¥ç®å½
./configure #é ç½®
make #ç¼è¯
make install #å®è£
å®è£ php
cd /usr/local/src
tar -zvxf php-5.3.13.tar.gz
cd php-5.3.13
mkdir -p /usr/local/php5 #建ç«phpå®è£ ç®å½
./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql-sock=/tmp/mysql.sock --with-gd --with-iconv --with-zlib --enable-xml --enable-magic-quotes --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-mcrypt --with-curl --with-jpeg-dir --with-freetype-dir #é ç½®
make #ç¼è¯
make install #å®è£
cp php.ini-production /usr/local/php5/etc/php.ini #å¤å¶phpé ç½®æ件å°å®è£ ç®å½
rm -rf /etc/php.ini #å é¤ç³»ç»èªå¸¦é ç½®æ件
ln -s /usr/local/php5/etc/php.ini /etc/php.ini #æ·»å 软é¾æ¥
cp /usr/local/php5/etc/php-fpm.conf.default /usr/local/php5/etc/php-fpm.conf #æ·è´æ¨¡æ¿æ件为php-fpmé ç½®æ件
vi /usr/local/php5/etc/php-fpm.conf #ç¼è¾
user = www #设置php-fpmè¿è¡è´¦å·ä¸ºwww
group = www #设置php-fpmè¿è¡ç»ä¸ºwww
pid = run/php-fpm.pid #åæ¶åé¢çåå·
cp /usr/local/src/php-5.3.13/sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm #设置 php-fpmå¼æºå¯å¨ï¼æ·è´php-fpmå°å¯å¨ç®å½
chmod +x /etc/rc.d/init.d/php-fpm #æ·»å æ§è¡æé
chkconfig php-fpm on #设置å¼æºå¯å¨
vi /usr/local/php5/etc/php.ini #ç¼è¾é ç½®æ件
注æï¼åæ¶FastCGI serveré¨ålocationç注é,并è¦æ³¨æfastcgi_paramè¡çåæ°,æ¹ä¸º/data/webroot/(æ¤ä¸ºç½ç«æ ¹ç®å½ç»å¯¹è·¯å¾)$fastcgi_script_name
/etc/init.d/nginx restart #éå¯nginx
æµè¯ç¯
访é®http://ipå°å åºç°æ¬¢è¿ä½¿ç¨nginxï¼è¯´æé ç½®æåãé»è®¤webç®å½ /usr/local/nginx/html/å¯ä»¥èªå·±åç¨åºæµè¯PHPæ¯å¦å¯ç¨ã
CentOS 7 用户怎样安装 LNMP
useradd -g www www -s \/bin\/false #创建nginx运行账户www并加入到www组,不允许www用户直接登录系统 tar zxvf nginx-1.2.0.tar.gz cd nginx-1.2.0 .\/configure --prefix=\/usr\/local\/nginx --without-http_memcached_module --user=www --group=www --with-http_stub_status_module --with-openssl...
我在centos7 上面搭建了LNMP环境. 我配置好后.在内网测试可以访问.但是...
分二步。首先查看设置是否正常。在本地Linux或者Windows的Client设置本地Host记录。设置域名指向对应的IP。对应nginx上设置域名指向。这样就可以通过Client。直接输入域名访问。应用。这步Ok了。说明你的设定就没有问题。第二步,如果你的网络是NAT映射关系,得先将内部Nginx的Web服务器映射出去,通过外网的C...
centos7.x下美国主机安装宝塔面板教程
一、前往宝塔官网 bt.cn\/new\/download.html,下载“宝塔SSH终端”并解压安装。二、在终端中输入美国云主机的IP地址和登录密码,保存并连接。三、执行宝塔安装代码 bt.cn\/bbs\/thread-19376-...若以上节点无法使用,请使用以下备用节点:备用节点【香港】:(香港主机不推荐)备用节点【美国】:(宝塔推荐...
在centos7安装zlib库,部署php环境用的,可能没装成功,后续安装提示它安...
1、典型的LNMP安装问题 2、首先你得准备编译环境 yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e...
centos7.x下美国主机安装宝塔面板教程
如果安装LNMP服务失败,通过SSH终端执行以下命令:`echo '128.1.164.196 download.bt.cn' >>\/etc\/hosts`然后再尝试重新安装LNMP服务。九、遇到面板相关疑难问题时,可参考宝塔社区提供的相关帖子 bt.cn\/bbs\/thread-87257-...本文整理自:centos7.x下美国主机安装宝塔面板教程 - icmarkets ...
如何在自己的云服务器上建网站?
详细安装过程可以看:云服务器建立个人网站 安装好之后,输入数字14,获取到后台登陆地址和用户名及密码。如图 进去以后选择一键安装“LNMP”,接着登陆到宝塔后台,找到左侧“软件商店”,然后选择一键部署wordpress 按要求填好相关的信息就可以了。搭建过程很简单,不会的话再多看两遍。
CentOS 7系统远程会话管理工具screen怎么安装使用
情景:需要在CentOS 7中下载并安装LNMP一键安装包;1、先执行以下命令screen -S shapolang以上命令的意思是:新建screen会话,名字为shapolang。2、开始安装lnmp,a、执行 wget --no-check-certificate https:\/\/api.sinas3.com\/v1\/SAE_lnmp\/soft\/lnmp1.2-full.tar.gz下载安装包。b、执行:tar -...
linux怎么快速安装nginx和php,不用安装数据库
Linux下如果要搭建nginx和php环境,需要安装三个软件包:nginx,php,php-fpm 比如说如果是centos的话:yum install nginx php php-fpm可能软件包名有差别,这个查查就知道了。然后配置nginx,修改nginx.conf,如果用sock就这样写,如果是端口就些端口:location ~ \\.php$ { fastcgi_pass unix:\/var...
腾讯云服务器如何安装宝塔面板?
1. 选择腾讯云轻量服务器的镜像,包括BT LINUX面板。如果需要个性化操作,建议自行安装。2. 开通服务器后,进入应用信息,重置应用。3. 选择CentOS 7.x系统,重置服务器密码并保存到本地记事本,方便以后使用。4. 检查防火墙端口设置,确保开放80、443、22、3389、888、8888、21端口。轻量服务器默认...
CentOS7.9基于PHP8.0+Apache+MySQL安装Nextcloud
1. 系统软硬件参数环境选择 CentOS 7.9 作为操作系统,确保具备足够的 RAM 和硬盘空间以支持 Nextcloud 系统运行。2. Nextcloud 参数路径说明Nextcloud 镜像基于 LAMP 环境构建,同时也支持 LNMP 架构。关键参数路径包括服务器 IP 地址、端口号、数据库配置等。3. 详细部署过程记录3.1 安装 CentOS 7.9...