建站第一天,记录下go+php+nginx+mysql的配置历程

in 杂谈心情运维 with 44 comments

最近尝试了一些小工具,又想要一个服务器来捣鼓了,遂使用Vultr注册了一个云主机,方便后续搞事情,在此记录下这次配置服务器环境的历程。

1、Golang

Golang安装是最简单的:
1.1、直接golang.orggolang.google.cn下载最新的tar包。

1.2、执行以下命令将压缩包解压并将go目录放置在/usr/local下

tar -C /usr/local -xzf go1.4.linux-amd64.tar.gz

1.3、再配置下Golang的运行环境如下

vim /etc/profile

1.4、在文件末尾增加,其中GOPATH为你自己的golang目录,我自己在/opt/go中,文件夹要包含src,pkg,bin三个目录

export PATH=$PATH:/usr/local/go/bin
export GOPATH=/opt/go
export GOBIN=$GOPATH/bin

1.5、至此,Golang已经全部配置完毕了,可以运行下看看go的运行环境

go env
至此用时2分钟,不得不说go的安装实在是方便

2、PHP7.3

PHP安装是最麻烦的,依赖环境多、编译时间久,

2.1、下载PHP安装包 php.net

2.2、解压缩安装包

tar zxf php-x.x.x

2.3、编译安装,这里涉及的环境比较多,我这里给出自己的编译配置,编译过程中会依次提示依赖包,需要自己一个一个yum安装

cd php-x.x.x
./configure --prefix=/usr/local/php  --with-config-file-path=/usr/local/php/etc --enable-fpm  --with-fpm-user=php-fpm  --with-fpm-group=php-fpm  --with-mysqli=mysqlnd --with-pdo-mysql  --with-libxml-dir  --with-gd  --with-jpeg-dir  --with-png-dir  --with-freetype-dir  --with-iconv-dir  --with-zlib-dir  --enable-soap --enable-mbstring  --enable-exif  --with-pear --enable-posix --enable-pcntl --with-curl  --with-openssl --disable-fileinfo
make && make install
cp php.ini-development /usr/local/php/php.ini

2.4、至此php安装完毕,在这里我顺带配置了php-fpm,以下是配置启动php-fpm的步骤

cp sapi/fpm/php-fpm/php-fpm.conf.default /usr/local/etc/php-fpm.conf
cp sapi/fpm/php-fpm /usr/local/bin
vim /usr/local/php/php.ini

2.5、设置cgi的配置,并设置php-fpm的用户和用户组,再运行php-fpm

cgi.fix_pathinfo=0
vim /usr/local/etc/php-fpm.conf
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
;       will be used.
user = www-data
group = www-data
/usr/local/bin/php-fpm

各种依赖装得头疼,装个PHP用了一个小时。

3、Openresty
因为工作原因,有时候需要用Lua写一点HTTP服务的中间件,所以在这里我选用了openresty

3.1、安装起来比较方便,根据官方文档Openresty

sudo yum install yum-utils
sudo yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
sudo yum install openresty
sudo yum install openresty-resty

4、Mysql5.6
4、1、这里我也偷了个懒,直接用yum install 安装了

yum -y install mysql.x86_64 mysql-server.x86_64 mysql-devel.x86_64
service mysqld start 

4、2、设置MySQLroot用户密码

mysql
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');
Responses
  1. Nerruse

    Generic cialis online buy generic cialis what color cialis pills buy generic cialis online where to get loans with bad credit payday loans online

    Reply
  2. elakEnaT

    fast cash cheap viagra online generic cialis buy cialis online generic viagra online

    Reply
  3. Skywown

    buy cialis online buy cheap cialis coupon loans online cialis online cheap cialis online

    Reply
  4. Encupt

    buy cialis personal loans payday loans buy generic cialis buy generic cialis online

    Reply
  5. Urbasia

    Generic cialis online pharmacy buy generic cialis soft tabs cialis pharmacy generic cialis online lenders for bad credit fast cash

    Reply
  6. Ascessy

    Cialis generic best price generic cialis online generic cialis work generic cialis online cash loans now loans for bad credit

    Reply
  7. etewly

    buy cialis generic buy generic viagra buy cialis online order cialis viagra

    Reply
  8. elakEnaT

    buy cialis generic cheap cialis online viagra online generic viagra cialis

    Reply
  9. Quenda

    cialis online cash advance online viagra payday loans online buy generic viagra

    Reply
  10. wretry

    Buy cialis generic online online cialis order generic cialis buy generic cialis payday loans online alberta quick cash advance online

    Reply
  11. Skyhonee

    Tadalafil manufacturer cialis 20mg buy generic cialis cheap canadian cialis generic cialis online bad credit personal loans loans for bad credit

    Reply
  12. Whellomy

    What if a girl takes viagra generic viagra uk generic cialis tadalafil cialis coupon

    Reply
  13. gliree

    Benefits of cialis generic drugs buy cialis online cialis professional generic cialis

    Reply
  14. veiffvof

    What are the best cialis pills cialis coupon get viagra prescribed online viagra online

    Reply
  15. Doserosy

    Probenecid aspirin cialis pills cialis online buy cialis viagra cialis cost

    Reply
  16. Berlog

    Edrugstore cialis pills cialis cialis online dose cialis pharmacy generic cialis online

    Reply
  17. Kiweemi

    Low blood pressure canada buy generic cialis cheap cialis watermelon and viagra order viagra

    Reply
  18. Accera

    Buy generic cialis online cheap cialis online xatral cialis online pharmacy cialis cost online pharmacy cialis Buy Cheap Cialis Online cialis 40 mg tablets cialis buy generic cialis viagra adalah cialis pills cheap cialis online cialis soft tabs generic

    Reply
  19. ionibre

    Viagra cialis generic sildenafil citrate Buy Cialis Online cialis generic buy cialis daily side effects cialis tablets cialis buy cialis online cheap Buy Cialis Online australia buy ch eap cialis online buy cheap cialis coupon generic cialis 20mg best buy cancun cialis

    Reply
  20. Urbasia

    Cialis canada online cialis online mail order cialis buy generic cialis online dose cialis pharmacy cheap cialis buy brand name cialis cialis generic walgreens cialis online pharmacy cialis cost buy generic cialis canada

    Reply
  21. Buffbelt

    Viagra brand name generic viagra top 10 cialis pills cialis online

    Reply
  22. cuhgesee

    Experience cialis 20mg buy cialis online shelf life cialis online pharmacy cialis online

    Reply
  23. nemorp

    Cheapest generic cialis online buy cialis viagra directions viagra

    Reply
  24. Stoora

    Walmart viagra price viagra tadalafil research chemicals cialis pills order buy generic cialis

    Reply
  25. Elanist

    Buy generic cialis cialis tadalafil versus cialis generic buy cialis online

    Reply
  26. Uploash

    Buy generic cialis 5mg online cialis coupon usa cialis generic cheap generic cialis buy cialis professional online cialis coupon generic cialis 20mg ebay mexico cheap cialis online cialis 20 mg online buy cialis cheap levaquin medline cialis generic pills

    Reply
  27. leange

    How much is viagra at walmart cialis generic buy cialis cheap cialis from canada cialis online buy tadalafil prescription online generic cialis online buy cheap generic cialis tegretol cialis cost cialis tablets in india buy cheap cialis online edrugstore cialis pills

    Reply
  28. unwite

    Cialis generic uk cheap cialis cialis 5mg cheap generic cialis search cialis generic cialis buy generic cialis online viagra sales in india cialis generic cialis coupon cialis 20mg generic buy cialis online cheap cheapest online cialis

    Reply
  29. Slumula

    Where to buy generic cialis buy cialis substitute for viagra viagra coupon

    Reply
  30. infanna

    Cialis online canadian pharmacy cialis cialis cialis dosage 20mg generic cialis

    Reply
  31. Skywown

    Funny viagra commercial cheap viagra online buy soft cialis buy cheap cialis online

    Reply
  32. uncoori

    Cialis ordering cheap cialis online generic cialis 20mg best buy cancun buy generic cialis

    Reply
  33. Peenda

    Reductil online without prescription cialis 20mg buy cialis online buy cialis online usa now canadian generic cialis online

    Reply
  34. Nerruse

    Compare cialis generic viagra buy cheap cialis coupon is there viagra for females generic viagra

    Reply
  35. Ethicy

    Viagra w aptece buy viagra generique cialis 20mg buy cialis online

    Reply
  36. Atmomi

    What colour are cialis tablets buy cialis online lamisil blogs cialis pills generic cialis online

    Reply
  37. Bloccarl

    Generic form of cialis cialis buy cheap cialis does bluecross cover viagra viagra coupon

    Reply
  38. immoniah

    And what cialis pills look like cialis online viva viagra buy viagra online

    Reply
  39. Gethyhut

    Price of cialis tablets buy cialis cialis tablet side effects generic cialis

    Reply
  40. Weabrix

    Viagra pronunciation cialis generic cheap cialis online buy tadalafil india tadacip generic cialis

    Reply
  41. Uploast

    What are the best cialis pills generic cialis generic cialis 20mg target mexico cheap cialis

    Reply
  42. arbique

    Cheap generic cialis pills cialis cheap cialis online pills that work like viagra buy viagra

    Reply
  43. slusly

    Over the counter viagra walmart viagra online natural forms of viagra cialis pills cialis cialis

    Reply
  44. best canadian mail order pharmacies
    http://canadianpharmaciesoffer.com/
    top 10 mail order pharmacies

    Reply