Install Nginx MySQL php fcgi on Ubuntu 10.10 Desktop

Source: Internet
Author: User
Tags install wordpress mysql command line

The operating environment is a patchwork old machine, running four gb cpu, GB memory, 40 Gb Seagate IDE hard disk, which is roughly 04 years of hardware level. For LNMP installation, only WordPress is installed.

The operating system is my own Ubuntu 10.10. It's okay to use Ubuntu on the desktop as a server. Remember to set the language environment to English.
I installed LNMP once with the one-click installation package of LNMP. The result was unsuccessful and the error was not found, so all purge started from scratch. This time, all the software is installed with apt and configured manually. The result is smooth sailing.



Install nginx:
1. sudo apt-get install nginx

Instantly installed. The general structure of nginx is
All configuration files are stored in/etc/nginx/
The virtual host is in/etc/nginx/sites-available/. Here I use "default"
You must create a link to the/etc/nginx/sites-available/Vm configuration file under/etc/nginx/sites-enabled/. The default link is ready for installation.
Log in/var/log/nginx/
The STARTUP script has been created in/etc/init. d/and also in/etc/rc2.d.
Start nginx now.

1. sudo/etc/init. d/nginx start

This is unlikely to be a problem. If the system prompts that bind fails, it may be that other processes (such as apache) occupy port 80 and stop.

Install php:

1. sudo apt-get install php5 php5-cgi php5-mysql php5-curl php5-gd php5-idn php5-imagick php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-pspell php5-recode php5-snmp

This is copied from someone else. I can't use this much, but it doesn't matter if I have to install more. If I have to install less, there may be problems with installing spawn-fcgi:

1. sudo apt-get install spawn-fcgi

I used to install php-fpm. As a result, the setting was not good, so I switched to spawn-fcgi instead. this was originally a lighttpd component, which was later independent and can be installed separately and used with nginx.

Configure nginx and spawn-fcgi: Modify/etc/nginx/fastcgi_params and add the following line:



1. sudo apt-get install spawn-fcgi

Find the line cgi. fix_pathinfo = 1 in/etc/php5/cgi/php. ini and remove the comment above. In this way, php-cgi can use the SCRIPT_FILENAME variable normally.
Open the/etc/nginx/sites-available/default file and make some modifications. I pasted my post here:

Server {



Listen 80; # listen for ipv4

Listen [:]: 80 default ipv6only = on; # listen for ipv6



Server_name localhost;



Root/var/www/nginx-default;



Access_log/var/log/nginx/localhost. access. log;



Location /{

Root/var/www/nginx-default;

Index. php index.html index.htm;

}



Location/doc {

Root/usr/share;

Autoindex on;

Allow 127.0.0.1;

Deny all;

}



Location/images {

Root/usr/share;

Autoindex on;

}



Error_page 404/404 .html;

Location =/404.html {

Root/var/www/nginx-default;

}



# Redirect server error pages to the static page/50x.html

#

Error_page 500 502 503 x.html;

Location =/50x.html {

Root/var/www/nginx-default;

}



# 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 Fig: 9000

#

Location ~ . Php $ {

Fastcgi_pass 127.0.0.1: 9000;

Fastcgi_index index. php;

# Fastcgi_param SCRIPT_FILENAME/scripts $ fastcgi_script_name;

Include fastcgi_params; ##### note that a space is missing here !!!

}



# Deny access to. htaccess files, if Apaches document root

# Concurs with nginxs one

#

# Location ~ /. Ht {

# Deny all;

#}

} Start spawn-fcgi:

1. sudo/usr/bin/spawn-fcgi-a 127.0.0.1-p 9000-C 5-u www-data-g www-data-f/usr/bin/php5-cgi-P/var /run/fastcgi-php.pid

There should be no bind failure. If it appears, you can find the process to kill or change the port.
We can add this line of code to the bottom of the/etc/rc. local file, so that the system can start the FastCGI process of PHP at the same time.



Reload nginx:

1. sudo/etc/init. d/nginx reload

After modifying the nginx configuration file, you must reload the file before it takes effect. Of course, restart is also supported. If you are prompted that the configuration file cannot be passed, go to the file to check for errors. Once, I found that the default file contains only one space.

Install PHP and MySQL:

1. sudo apt-get install mysql-server mysql-client
Enter the Root user password.
Start MySQ

1. Lsudo/etc/init. d/mysql start

I don't know SQL, so I didn't use the mysql command line to set it. Instead, I used phpmyadmin to set it on the browser page.

Install WordPress:
This is the easiest and most enjoyable thing to do, within five minutes. What needs to be done is to create a user and a database, then directly access the wordpress folder and follow what it says


 

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.