Linux下安裝Nginx+PHP7.1+MySQL5.7
yum
的安裝
yum update
yum
安裝nginx
安裝nginx
最新源
yum localinstall http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum repolist enabled | grep "nginx*"
安裝nginx
yum -y install nginx
啟動nginx
service nginx start
設定nginx
伺服器開機自啟動
systemctl enable nginx.service
檢查開機自動是否設定成功
systemctl list-dependencies | grep nginx
瀏覽器中輸入公網ip
,檢測是否安裝成功
使用yum
安裝mysql5.7
安裝mysql
源
yum -y localinstall http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
yum repolist enabled | grep "mysql.*-community.*"
安裝mysql
yum -y install mysql-community-server install mysql-community-devel
啟動mysql
service mysqld start
檢查mysql
啟動是否正常
service mysqld status 或者 ps -ef | grep mysql
設定mysqld
服務開機自啟動
systemctl enable mysqld.service
檢查mysqld
開機自啟動是否設定成功
systemctl list-dependencies | grep mysqld
mysql5.7
以後的爭強了安全機制, 所以使用yum
安裝,啟動會系統會自動生成一個隨機的密碼,修改mysql
密碼
檢視mysql
的隨機密碼
grep 'temporary password' /var/log/mysqld.log
使用查詢得到的隨機密碼在終端登入mysql -u root -p
更改密碼(mysql
文件規定,密碼必須包括大小寫字母數字加特殊符號>8
位)
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Yourpassword';
退出mysql
客戶端,用剛才修改的密碼登入確保密碼修改成功
exit;
mysql -u root -p
安裝php7.1
安裝php
源
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
檢查源是否安裝成功
yum repolist enabled | grep "webtatic*"
安裝php
擴充套件源
yum -y install php71w php71w-fpm
yum -y install php71w-mbstring php71w-common php71w-gd php71w-mcrypt
yum -y install php71w-mysql php71w-xml php71w-cli php71w-devel
yum -y install php71w-pecl-memcached php71w-pecl-redis php71w-opcache
驗證php7.1.x
和擴充套件是否安裝成功
驗證php
是否安裝成功
php -v
驗證對應的擴充套件是否安裝成功
php -m
設定php-fpm
並檢測php-fpm
的執行狀態
啟動php-fpm
service php-fpm star
檢查啟動是否成功
service php-fpm status
設定開機自啟動
systemctl enable php-fpm.service
檢查開機自啟動是否設定成功
systemctl list-dependencies | grep php-fpm
ps -ef | grep php-fpm
nginx
配置如下:
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
set $root '你專案的目錄';
location / {
root $root;
index index.php index.html index.htm;
}
#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 html;
}
# 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 $root;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $root$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;
#}
}
相關文章
- Linux下安裝、解除安裝mysqlLinuxMySql
- linux下安裝snap安裝工具Linux
- Linux下JDK安裝與解除安裝LinuxJDK
- Linux下安裝RedisLinuxRedis
- mysql linux下安裝MySqlLinux
- Linux 下安裝 RedisLinuxRedis
- Linux下安裝GitLinuxGit
- Linux下安裝pymysqlLinuxMySql
- Linux下安裝jiebaLinuxJieba
- Linux下安裝GensimLinux
- Linux下SuperLU安裝Linux
- Linux下安裝RabbitMQLinuxMQ
- linux下安裝elasticsearchLinuxElasticsearch
- Linux下expect安裝Linux
- Linux 下安裝pipLinux
- Linux 下安裝 MongodbLinuxMongoDB
- linux下安裝VMtoolsLinux
- linux下安裝numpyLinux
- Linux下安裝ApacheLinuxApache
- Linux下Mysql安裝LinuxMySql
- Linux下安裝phpLinuxPHP
- linux 下安裝mysqlLinuxMySql
- linux下安裝djangoLinuxDjango
- linux下安裝MysqlLinuxMySql
- linux 下 gd 安裝Linux
- linux 下postfix安裝Linux
- Linux下安裝OpenCVLinuxOpenCV
- Linux下安裝nginxLinuxNginx
- linux下nginx安裝LinuxNginx
- linux下安裝dockerLinuxDocker
- linux 下安裝 jdkLinuxJDK
- Windows下的Memcache安裝 linux下的Memcache安裝WindowsLinux
- [linux]linux下安裝mysqlLinuxMySql
- Linux下安裝java及配置(yum安裝)LinuxJava
- Maven的安裝/2.2 Linux下的安裝MavenLinux
- Linux下怎麼安裝.deb格式的安裝包?Linux系統下.deb格式安裝包的安裝教程Linux
- Linux下安裝MySQL 5.7LinuxMySql
- Linux下ODBC安裝配置Linux