Alibaba Cloud Server cent0s Install Web environment Php+mysql+nginx, add website to Nginx

Source: Internet
Author: User
Tags aliyun
Download the one-click installation package:

Http://market.aliyun.com/product/12-121590002-cmgj000262.html?spm=5176.7150518.1996836753.5.ZoE32o


Installing the RZ command on the server

Yum Install Lrzsz


RZ Select the file to upload Sh.zip


To install the decompression command:

Yum install unzip #本机已经安装了. So don't install it here.

Extract

Unzip-x Sh.zip #解压后脚本的权限不够

Chmod-r 755 sh #-r Recursively change all file permissions in the directory to 755


Executed under the SH directory

./install.sh


After the installation is complete, check

Ps-ef|grep Nginx

Ps-ef|grep MySQL


Executed under the SH directory

Cat Account.log #查看mysql账号密码

Ftp:

Account:www

Password:zzzzzz

Mysql:

Account:root

Password:zzzzzz


Netstat-nat #查看3306端口有没有listen

Rpm-q MySQL #查询发现是mysql-server not installed

Yum Install mysql-server #安装mysql-server Service

Service mysqld Restart


MySQL #查看mysql信息

Mysql-p3306-u User name-p password #登录mysql

Mysql-p3306-uroot-pzzzzzzz

Use MySQL #进入mysql这个数据库

Show tables

DESC user

Select Host,user,password from User; #查看数据库用户

Exit #退出

Mysql-p3306-u User name-p password #登录mysql

Use MySQL

Update user set host= '% ' where host= ' localhost ' #% denotes arbitrary so that the IP can be connected to other computers

Flush Privileges #刷新


On the external computer:

Browser input: Server IP # set Phpwind


Nginx Add Website:


In the server directory:/alidata/server has the following directory:

MySQL mysql-5.6.21 nginx nginx-1.4.4 php php-5.5.7


Entry directory:/alidata/server/nginx/conf

Cat nginx.conf #这个文件找到最后一行

include/alidata/server/nginx/conf/vhosts/*.conf;

#包含了vhosts下面所有配置文件, a website a conf


Entry directory: alidata/server/nginx/conf/vhosts/

View files: Cat phpwind.conf

File start:::::

server {

Listen 80;

server_name localhost; #这里localhost, so the browser input IP can be accessed, if the input www.xxx.com, the browser can only enter the relevant domain name

Index index.html index.htm index.php;

Root/alidata/www/phpwind;

Location ~. *\. (PHP|PHP5)? $

{

#fastcgi_pass Unix:/tmp/php-cgi.sock;

Fastcgi_pass 127.0.0.1:9000;

Fastcgi_index index.php;

Include fastcgi.conf;

}

Location ~. *\. (gif|jpg|jpeg|png|bmp|swf) $

{

Expires 30d;

}

Location ~. *\. (JS|CSS)? $

{

Expires 1h;

}

#伪静态规则

include/alidata/server/nginx/conf/rewrite/phpwind.conf;

Access_log/alidata/log/nginx/access/phpwind.log;


File Ends:::::::::


Add site: www.paidaxue.com


CP Default.conf.bak paidaxue.conf

Modified files: Vim paidaxue.conf

Modified: server_name localhost;

Modified to:

server_name www.paidaxue.com;

Modified: Root/alidata/www/phpwind;

Modified to:

root/alidata/www/paidaxue.com;


Modify: If the original does not have this paragraph to ignore the changes

Log_farmat Aliyun ' $remote _addr-$remote _user [$time _local] "$request" '

' $status $body _bytes_sent ' $http _referer '

' "$http _user_agent" "$http _x_forwarded_for";

Modified to:

Log_farmat Paidaxue ' $remote _addr-$remote _user [$time _local] "$request" '

' $status $body _bytes_sent ' $http _referer '

' "$http _user_agent" "$http _x_forwarded_for";


Modify:

Access_log/alidata/log/nginx/access/default.log;

Modified to:

access_log/alidata/log/nginx/access/paidaxue.com;


Save


Enter directory:

/alidata/server/nginx/sbin/nginx-s Reload #重启nginx


Browser input: www.paidaxue.com #会显示404not found because there is no corresponding directory


New Catalog: alidata/www/paidaxue.com

Mkdir-p/alidata/www/paidaxue.com


To view the new directory: #paidaxue. com is in root user, root user group

Drwxr-xr-x 2 root root 4096 Jan 17:00 paidaxue.com

Drwxr-xr-x www www 4096 Jan 16:15 phpwind


Browser input: www.paidaxue.com #会显示403Forbidden because there is no access

So to change the permissions of the paidaxue.com, and become the same as the following www

cd/alidata/www/


Chown-r www:www/alidata/www/paidaxue.com

Browser input: www.paidaxue.com #会显示403Forbidden because there are no files inside.

Cd/alidata/www/paidaxue.com

New index.html in the folder above

Browser input: www.paidaxue.com #正常

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.