Fedora system installation and configuration NginxMySQLPostgreSQLPythonPHP server ring

Source: Internet
Author: User
Record the installation and configuration of Linux + Nginx + MySQL + PostgreSQL + Python + PHP. Is the legendary LNMPPP ~ To put it bluntly, the OS uses Linux, Webserver uses Nginx, Python and PHP, and the database supports PostgreSQL and MySQL. Let's get started ~ LinuxFedora13 (available for other Linux releases

Record the installation and configuration of Linux + Nginx + MySQL + PostgreSQL + Python + PHP. Is the legendary LNMPPP ~ To put it bluntly, the OS uses Linux, the Web server uses Nginx, Python and PHP, and the database supports PostgreSQL and MySQL. Let's get started ~

Linux
Fedora 13 (other Linux releases may require slight changes)
Nginx

Install

Yum install Nginx

Add to system Auto run

Chkconfig -- levels 235 nginx on

Start

/Etc/init. d/nginx start

Nginx has been installed and started. visit http: // localhost /.

MySQL

Install

Yum install Mysql  Mysql-Server

Add and start system services

Chkconfig -- levels 235 mysqld on

Start

/Etc/init. d/mysqld start

Check whether network connection is supported

Netstat-tap | grep mysql

This status should be displayed.

Netstat-tap | grep mysql
Tcp 0 0 *: mysql *: * LISTEN 1376/mysqld

If not, modify the/etc/my. cnf file to enable network connection support and remove "#" of "# skip-networking" in the file.

Restart mysql

/Etc/init. d/mysqld restart

By default, the password of the root user in MySQL is empty. you need to set the password for the root user (* indicates the password character)

Mysqladmin-u root password *****
PostgreSQL

Install

Yum install Postgresql  Postgresql-Server

Then you need to initialize

Service postgresql initdb

Open the/var/lib/pgsql/data/pg_hba.conf file and change the data in the Ipv4 localconnections column:

Host all 0.0.0.0 trust

Add a remote connection, delete the comments of listen_sddress and port in/var/lib/pgsql/data/postgresql. conf, and change them:

Listen_address = '*'
Port = 5432

[Optional] install postgresql management tool pgadmin3

Yum install pgadmin3

[Optional] added support for python

Yum install python-psycopg2
Python

Er, in fact, the Python version provided by Fedora is relatively new. you only need to install flup and configure it.

Install flup

Sudo easy_install flup

Update Nginx configuration file nginx. conf

Server {
Listen 80;
Server_name localhost;
# Site_media-folder in uri for static files
Location/static {
Root/var/www/static;
}
Location ~ * ^. + \. (Jpg | jpeg | gif | png | ico | css | zip | tgz | gz | rar | bz2 | doc | xls | exe | pdf | ppt | txt | tar | mid | midi | wav | bmp | rtf | js | mov) {
Access_log off;
Expires 30d;
}
Location /{
# Host and port to fastcgi server
Fastcgi_pass 127.0.0.1: 8000;
Fastcgi_param PATH_INFO $ fastcgi_script_name;
Fastcgi_param REQUEST_METHOD $ request_method;
Fastcgi_param QUERY_STRING $ query_string;
Fastcgi_param CONTENT_TYPE $ content_type;
Fastcgi_param CONTENT_LENGTH $ content_length;
Fastcgi_pass_header Authorization;
Fastcgi_intercept_errors off;
}
Access_log/var/log/nginx/localhost. access_log main;
Error_log/var/log/nginx/localhost. error_log;
}
PHP

Install PHP

Yum install php-cli php-mysql php-pgsql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-eaccelerator php-magickwand php- magpierss php-mapserver php-mbstring php-mcrypt php-shout php-snmp php-soap php-tidy

Append 'CGI. fix_pathinfo = 1' to the/etc/php. ini file'

Update Nginx configuration file nginx. conf

Server {
Listen 80;
Server_name localhost;
# Charset KOI8-R;
# Access_log logs/host. access. log main;
Location /{
Root/usr/share/nginx/html;
Index. php index.html index.htm;
}
Error_page 404/404 .html;
Location =/404.html {
Root/usr/share/nginx/html;
}
Error_page 500 502503 504/50 x.html;
Location =/50x.html {
Root/var/www;
}
Location ~ \. Php $ {
Root html;
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
Fastcgi_param SCRIPT_FILENAME/var/www $ 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;
}
}

Use FCGI to start PHP on port 9000

/Usr/bin/spawn-fcgi-a 127.0.0.1-p 9000-u nginx-g nginx-f/usr/bin/php-cgi-P/var/run/fastcgi-php.pid

It is difficult to manually start each time. you can directly append the above content to the/etc/rc. local file for automatic start.

EOF

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.