ubuntu 安装 nginx以及apache安装配置
来源:互联网 发布:美图美妆软件 编辑:程序博客网 时间:2024/05/23 02:03
sudo apt-get update
sudo apt-get upgrade
apt-get -y install mysql-server && apt-get -y install apache2 && sudo apt-get -y install php5 libapache2-mod-php5 && /etc/init.d/apache2 restart && apt-get -y install libapache2-mod-auth-mysql && apt-get -y install php5-mysql && /etc/init.d/apache2 restart
nginx
第一步,安装nginx
apt-get update
apt-get install nginx
即可完成安装
启动nginx:
/etc/init.d/nginx start
然后就可以访问了,http://localhost/ , 一切正常!如果不能访问,先不要继续,看看是什么原因,解决之后再继续。
第二步
配置文件目录 /etc/nginx/ nginx.conf /sites-available/default
www目录 /var/www/nginx-default/
日志文件:
localhost.access.log /var/log/nginx/localhost.access.log
access.log /var/log/nginx/access.log
error.log /var/log/nginx/error.log
第三步 虚拟主机配置
------------------------------虚拟主机配置
server {
listen 80;
server_name localhost;
access_log /var/log/nginx/localhost.access.log;
location / {
root /var/www/nginx-default;
index 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;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/nginx-default$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}
server {
listen 80;
server_name sdsssdf.localhost.com;
access_log /var/log/nginx/localhost.access.log;
location / {
root /var/www/nginx-default/console;
index 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;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/nginx-default$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}
第四步
sudo ln -s 源文件 目标文件
sudo /etc/init.d/nginx restart
apache2
- ubuntu 安装 nginx以及apache安装配置
- ubuntu 安装 nginx以及apache安装配置
- ubuntu 下 nginx 的安装以及配置
- Nginx,Apache安装配置
- Nginx 安装以及配置
- Ubuntu安装配置Nginx
- Apache安装以及配置
- Ubuntu安装配置Apache
- ubuntu-server下apache安装配置以及优化
- Ubuntu Apache的安装和配置以及CGI的设置
- Ubuntu Apache的安装和配置以及CGI的设置
- Ubuntu Apache的安装和配置以及CGI的设置
- Ubuntu Apache的安装和配置以及CGI的设置
- Nginx的安装以及配置
- Nginx环境配置以及安装
- windows10 安装以及配置nginx
- linux nginx安装以及配置
- Nginx安装配置以及https
- 程序员如何保持优秀
- 经典收藏 50个jQuery Mobile开发技巧集萃
- 用类别重写系统API的方法,去除xcode警告
- [编译环境] pkg-config for mac 安装
- android – 多屏幕适配相关
- ubuntu 安装 nginx以及apache安装配置
- 使用 PIVOT 和 UNPIVOT
- Unity3D Shader官方教程翻译(四)----Shader语法:SubShader
- Unity3D Shader官方教程翻译(五)----Shader语法:Pass
- socket套接字选项列表
- Rational Rose和PowerDesigner两款建模工具分析比较
- Dark Launching
- Unity3D Shader官方教程翻译(六)----Shader语法:Pass的Color, Material, Lighting
- VIA深圳linux驱动软件工程师面试试题
ubuntu下apache2建立虚拟主机
1. 打开目录 /etc/apache2/sites-available/, 发现 default 和 default-ssl 两个文件, 其中 default 是 http 虚拟主机服务的配置文件, default-ssl 是配置 https 服务使用的。 复制default为一个新文件, 文件名必须与域名一致 (如: test.drupal.com)
2. 新建 ServerName test.drupal.com
修改配置:
DocumentRoot /var/www/drupal
ErrorLog ${APACHE_LOG_DIR}/test.drupal.com-error.log
CustomLog ${APACHE_LOG_DIR}/test.drupal.com-access.log combined
3. 激活虚拟主机
sudo a2ensite test.drupal.com
4. 网站添加成功了,重启apache
sudo /etc/init.d/apache2 restart
5. 不想用了删除域名
sudo a2dissite test.drupal.com
****(不要忘记)sudo a2enmod rewrite