nginx网站(nginx.org)
nginx网站
具体方法如下:
1、点击“开始”菜单,选择“控制面板”;
2、进入“控制面板”界面,双击“添加或删除程序”;
3、点击“添加/删除windows组件”进入windows组件向导,勾选“Internet信息服务(IIS)”点击下一步,此时如果你没放入系统盘的话会提示你放入系统盘,放入系统盘后完成安装;
4、此时web服务器IIS就已经安装完成了,在“管理工具”里就可以看到Internet信息服务了。
nginx.org
我的回答:是Apache软件基金会的官网。
apache是Linux系统里面市场占有率第一的web 浏览器,用来建网站的,相当于Windows系统里面的IIS。
apache这款web server正在被nginx 赶超,不久的将来,轻量型的Nginx将取代Apache的地位。
nginx 网页
意思就是你已经把nginx安装好了。 你看到这个页面说明nginx已经安装成功正在运行了。
下一步配置网站主机,上传程序。
nginx新建网站
想要搭建个人网站,就需要有单独的服务器,就在阿里云购买了台服务器,选择系统为“Ubuntu 14.04.5 LTS”,并在阿里云买了个域名(域名是为了方便记忆,否则输入ip地址访问网站很不方便),下面就使用Ubuntu系统搭建WordPress个人网站。
安装WordPress运行环境
1.安装Mysql数据库
apt update
apt upgrade
apt install mysql-server
查看mysql是否安装成功:
root@iZ2zeeg42qkecbhciml4pcZ:~# mysql --version
mysql Ver 14.14 Distrib 5.5.62, for debian-linux-gnu (x86_64) using readline 6.3
2.安装PHP
apt-get install software-properties-common
add-apt-repository ppa:ondrej/php
apt update
apt install php7.2
apt install libapache2-mod-php7.2
apt install php7.2-mysql
apt install php7.2-fpm
查看php是否安装成功:
root@iZ2zeeg42qkecbhciml4pcZ:~# php -v
PHP 7.2.16-1+ubuntu14.04.1+deb.sury.org+1 (cli) (built: Mar 7 2019 20:42:24) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.16-1+ubuntu14.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
3.安装Nginx
install nginx
查看Nginx是否安装成功:
root@iZ2zeeg42qkecbhciml4pcZ:~# nginx -v
nginx version: nginx/1.4.6 (Ubuntu)
重启Nginx后,在浏览器中输入http://阿里云服务器外网IP地址/
service nginx stop
service nginx start
如果图片显示为下图,说明阿里云服务器自动启动了apache2的服务,apache2和nginx都使用80端口,80端口冲突。
关闭apache2的服务
重启php7.2-fpm服务和Nginx服务:
在浏览器中输入http://阿里云服务器外网IP地址/
安装WordPress及其配置
1.Mysql创建数据库和用户:
root@iZ2zeeg42qkecbhciml4pcZ:~# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 44
Server version: 5.5.62-0ubuntu0.14.04.1 (Ubuntu)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database 数据库名称 character set utf8 collate utf8_general_ci;
Query OK, 1 row affected (0.00 sec)
mysql> grant all on 数据库名称.* to '用户名'@localhost identified by '用户密码';
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
root@iZ2zeeg42qkecbhciml4pcZ:~#
2.下载WordPress并安装:
获取WordPress软件:点击此处
将下载的wordpress-5.0.3-
zh_CN.tar.gz
上传到云服务器上安装wordPress:
root@iZ2zeeg42qkecbhciml4pcZ:~# ls
wordpress-5.0.3-zh_CN.tar.gz
root@iZ2zeeg42qkecbhciml4pcZ:~# mv wordpress-5.0.3-zh_CN.tar.gz /var/www/
root@iZ2zeeg42qkecbhciml4pcZ:~# cd /var/www/
root@iZ2zeeg42qkecbhciml4pcZ:/var/www# ls
html wordpress-5.0.3-zh_CN.tar.gz
root@iZ2zeeg42qkecbhciml4pcZ:/var/www# tar -zxvf wordpress-5.0.3-zh_CN.tar.gz
......
root@iZ2zeeg42qkecbhciml4pcZ:/var/www# ls
html wordpress wordpress-5.0.3-zh_CN.tar.gz
root@iZ2zeeg42qkecbhciml4pcZ:/var/www# cd wordpress/
root@iZ2zeeg42qkecbhciml4pcZ:/var/www/wordpress# ls
index.php readme.html wp-admin wp-comments-post.php wp-content wp-includes wp-load.php wp-
mail.php
wp-signup.php xmlrpc.phplicense.txt
wp-activate.php wp-blog-header.php wp-config-sample.php wp-cron.php wp-links-opml.php wp-login.php wp-settings.php wp-trackback.phproot@iZ2zeeg42qkecbhciml4pcZ:/var/www/wordpress# mv wp-config-sample.php wp-
config.php
使用vim命令编辑wp-config.php:
vim wp-config.php
修改文件中的数据库配置信息,填写刚才创建的数据库信息:
/** WordPress数据库的名称 */
define('DB_NAME', '数据库名称');
/** MySQL数据库用户名 */
define('DB_USER', '用户名');
/** MySQL数据库密码 */
define('DB_PASSWORD', '数据库密码');
/**
* WordPress数据表前缀。
*
* 如果您有在同一数据库内安装多个WordPress的需求,请为每个WordPress设置
* 不同的数据表前缀。前缀名只能为数字、字母加下划线。
*/
$table_prefix = 'wp_';
在阿里云控制台将域名解析到指定的服务器上:
控制台->域名->解析->添加纪录
配置服务安全组策略,将80(http)端口和443(https)端口开放:
控制台->云服务器ECS->网络和安全->安全组->配置规则
配置80端口:
配置443端口:
配置后查看内容:
编辑Nginx配置文件:/etc/nginx/sites-available/default
client_max_body_size 10m;
server {
listen 80;
listen [::]:80;
server_name localhost; #你的域名
root /var/www/wordpress;
index index.php index.html index.htm index.nginx-debian.html;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
#try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
# include fastcgi.conf;
include fastcgi_params;
fastcgi_buffer_size 128k;
fastcgi_buffers 32 32k;
#fastcgi_intercept_errors on;
# With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
# With php-cgi (or other tcp sockets):
#fastcgi_pass 127.0.0.1:9000;
}
}
重启Nginx后,在浏览器中输入http://阿里云服务器外网IP地址/
service nginx stop
service nginx start
在浏览器中访问自己的域名,查看是否成功:
到此WordPress就安装成功了,你可以自行配制您的网站信息。
nginx最新
区别有以下几点:
1、二者最核心的区别在于apache是同步多进程模型,一个连接对应一个进程;nginx是异步的,多个连接(万级别)可以对应一个进程 。nginx处理静态文件好,耗费内存少.但无疑apache仍然是目前的主流,有很多丰富的特性.所以还需要搭配着来.当然如果能确定nginx就适合需求,那么使用nginx会是更经济的方式。
2、nginx的负载能力比apache高很多。最新的服务器也改用nginx了。而且nginx改完配置能-t测试一下配置有没 有问题。
3、apache重启的时候发现配置出错了,会很崩溃,改的时候都会非常小心翼翼现在看有好多集群站,前端nginx抗并发,后端apache集群, 配合的也不错。
4、nginx处理动态请求是鸡肋,一般动态请求要apache去做,nginx只适合静态和反向。
5、从经验来看,nginx是很不错的前端服务器,负载性能很好,nginx,用webbench模拟10000个静态文件请求毫不吃力。 apache对php等语言的支持很好,此外apache有强大的支持网络,发展时间相对nginx更久,bug少但是apache有先天不支持多核心处理负载鸡肋的缺点,建议使用nginx做前端,后端用apache。大型网站建议用nginx自代的集群功能。
6、大部分情况下nginx都优于APACHE,比如说静态文件处理、PHP-CGI的支持、反向代理功能、前端 Cache、维持连接等等。在Apache+PHP(prefork)模式下,如果PHP处理慢或者前端压力很大的情况下,很容易出现Apache进程数 飙升,从而拒绝服务的现象。
7、Apache在处理动态有优势,Nginx并发性比较好,CPU内存占用低,如果rewrite频繁,那还是Apache吧!
8、一般来说,需要性能的web 服务,用nginx 。如果不需要性能只求稳定,那就apache 吧。
以上就是我的回答,希望可以帮助题主。
本网站文章仅供交流学习 ,不作为商用, 版权归属原作者,部分文章推送时未能及时与原作者取得联系,若来源标注错误或侵犯到您的权益烦请告知,我们将立即删除.