[Linux] Configure Linux servers under Mac and install nginx+php

Source: Internet
Author: User
Tags apc

Linux
  • Installing the Debian system

    I installed the Debian7.5 system, theDebian package management and upgrade is very convenient, and the system is also very stable.
    Installation disk can go to Huazhong University of Science and Technology image, NetEase open-source mirror station or the Chinese University of Science mirror Download, and the official website, General download will provide DVD-1,DVD-2 and DVD-3 download, The latter two are some of the less popular software, only need to download and install DVD-1 .

  • Modify Sources.list

    The first thing after installing the system is to modify the Debian source, because the default configuration will access the mirrored media, the source can be directly networked through the apt-get acquisition and installation of software packages, you can use: NetEase Debian image source. Save with VI Edit and remember to update the package when you have finished editing.

vi/etc/apt/sources.list//Edit software source apt-get Update//update package list Apt-get upgrade//update all installed packages Apt-get Dist-upgrade//Upgrading the system to a new version  
    • sshssh is a standard configuration for every Linux computer, and simply, it is a network protocol that can be used to encrypt logins between computers. If you are not familiar with ssh , you can read the SSH principle and application of Nanyi teacher (i): Telnet
apt-get install openssh-server   apt-get install ssh  
Mac
    • root Log in remotely using the root user login to the previously configured remote Linux Host, more detailed operation recommended to read the initial configuration of the Linux server process
ssh [email protected]
  • Configure SSH in order to avoid having to enter IP address every time, at ~/.ssh created config file, can be directly used ssh host1 Connect to the remote server.
Host host1HostName 222.222.222.22  User why  Port 1223
Nginx

After configuring the server and connecting remotely with SSH , it is easy to install Nginx . Here I refer to an article on the binarytides : Setup Nginx + php-fpm + APC + MariaDB on Debian 7 first install Nginx:

apt-get install nginx

Run the following command to start the Nginx server:

service nginx start

Visit and localhost you will see Welcome to nginx! instructions to install successfully.

The next step is to install PHP and php-fpm:

apt-get install PHP5 PHP5-fpm

Then, modify the Nginx configuration file:

vi /etc/nginx/sites-available/default

For specific configuration content, please check the website: Nginx CONFIG. Change the PHP -related content to the following:

location ~ \.php$ {fastcgi_split_path_info ^ (. +\.php) (/.+) $;# # note:you should has "cgi.fix_pathinfo = 0;" In ph    p.ini# # with php5-cgi alone:# Fastcgi_pass 127.0.0.1:9000;    # with Php5-fpm:fastcgi_pass Unix:/var/run/php5-fpm.sock;    Fastcgi_index index.php; Include Fastcgi_params;}  

then create index.php is written in the following text:

<?php    phpinfo();?>

Then visit the local address to see the page to view the PHP properties.

Other
    • Set the default text editor to vim under Debian
apt-get install vimupdate-alternatives --config editor
    • Login with SSH key

1. If the computer is not configured for SSH, enter the following command to generate the key:

ssh-keygen  

2. Thank you, second floor friend   take a stone run   reminders, use homebrew to add ssh-copy-id Command:

brew install ssh-copy-id

3. Upload the generated public key to the server:

ssh-copy-id [email protected]  

Resources:

    • Linux Server Initial configuration process
    • SSH principles and applications (SSH principle and application (i): remote login)
    • Introduction to PostgreSQL Novice
    • Debian Manual Howto
    • Nginx Beginner ' s Guide
    • Setup Nginx + php-fpm + APC + MariaDB on Debian 7
    • What is SFTP

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.